gnu_gettext.hpp
//
// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_LOCLAE_GNU_GETTEXT_HPP
#define BOOST_LOCLAE_GNU_GETTEXT_HPP
#include <boost/locale/message.hpp>
#include <boost/function.hpp>
#include <stdexcept>
namespace boost {
namespace locale {
namespace gnu_gettext {
struct messages_info {
messages_info() :
language("C"),
locale_category("LC_MESSAGES")
{
}
std::string language;
std::string country;
std::string variant;
std::string encoding;
std::string locale_category;
struct domain {
std::string name;
std::string encoding;
domain() {}
domain(std::string const &n)
{
size_t pos = n.find("/");
if(pos==std::string::npos) {
name = n;
encoding = "UTF-8";
}
else {
name = n.substr(0,pos);
encoding = n.substr(pos+1);
}
}
bool operator==(domain const &other) const
{
return name==other.name;
}
bool operator!=(domain const &other) const
{
return !(*this==other);
}
};
typedef std::vector<domain> domains_type;
domains_type domains;
std::vector<std::string> paths;
typedef function<
std::vector<char>(
std::string const &file_name,
std::string const &encoding
)
> callback_type;
callback_type callback;
};
template<typename CharType>
message_format<CharType> *create_messages_facet(messages_info const &info);
template<>
BOOST_LOCALE_DECL message_format<char> *create_messages_facet(messages_info const &info);
template<>
BOOST_LOCALE_DECL message_format<wchar_t> *create_messages_facet(messages_info const &info);
#ifdef BOOST_LOCALE_ENABLE_CHAR16_T
template<>
BOOST_LOCALE_DECL message_format<char16_t> *create_messages_facet(messages_info const &info);
#endif
#ifdef BOOST_LOCALE_ENABLE_CHAR32_T
template<>
BOOST_LOCALE_DECL message_format<char32_t> *create_messages_facet(messages_info const &info);
#endif
} // gnu_gettext
} // locale
} // boost
#endif
// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
boost::locale::info
a facet that holds general information about locale
Definition: info.hpp:27
boost::locale::gnu_gettext::messages_info::domains
domains_type domains
Definition: gnu_gettext.hpp:99
boost::locale::gnu_gettext::messages_info::domain::operator!=
bool operator!=(domain const &other) const
Definition: gnu_gettext.hpp:90
boost::locale::gnu_gettext::messages_info::encoding
std::string encoding
Definition: gnu_gettext.hpp:44
boost::locale::gnu_gettext::messages_info::locale_category
std::string locale_category
Definition: gnu_gettext.hpp:46
boost::locale::gnu_gettext::messages_info
This structure holds all information required for creating gnu-gettext message catalogs,.
Definition: gnu_gettext.hpp:34
boost::locale::gnu_gettext::messages_info::domain::domain
domain(std::string const &n)
Definition: gnu_gettext.hpp:66
boost::locale::gnu_gettext::messages_info::domain::operator==
bool operator==(domain const &other) const
Definition: gnu_gettext.hpp:83
boost::locale::gnu_gettext::messages_info::paths
std::vector< std::string > paths
Definition: gnu_gettext.hpp:101
boost::locale::message_format
This facet provides message formatting abilities.
Definition: message.hpp:47
boost::locale::gnu_gettext::messages_info::domain
This type represents GNU Gettext domain name for the messages.
Definition: gnu_gettext.hpp:55
boost::locale::gnu_gettext::messages_info::language
std::string language
The language we load the catalog for, like "ru", "en", "de".
Definition: gnu_gettext.hpp:41
boost::locale::gnu_gettext::messages_info::domains_type
std::vector< domain > domains_type
Definition: gnu_gettext.hpp:97
boost::locale::gnu_gettext::messages_info::domain::name
std::string name
The name of the domain.
Definition: gnu_gettext.hpp:57
boost::locale::gnu_gettext::messages_info::callback_type
function< std::vector< char > std::string const &file_name, std::string const &encoding) > callback_type
Definition: gnu_gettext.hpp:119
boost::locale::gnu_gettext::messages_info::callback
callback_type callback
Definition: gnu_gettext.hpp:125
boost::locale::gnu_gettext::messages_info::country
std::string country
The country we load the catalog for, like "US", "IL".
Definition: gnu_gettext.hpp:42
boost::locale::gnu_gettext::create_messages_facet
message_format< CharType > * create_messages_facet(messages_info const &info)
boost::locale::gnu_gettext::messages_info::variant
std::string variant
Language variant, like "euro" so it would look for catalog like de_DE@euro.
Definition: gnu_gettext.hpp:43
boost::locale::gnu_gettext::messages_info::domain::encoding
std::string encoding
The character encoding for the domain.
Definition: gnu_gettext.hpp:58
- © Copyright 2009-2012 Artyom Beilis, Distributed under the Boost Software License, Version 1.0.