gnu_gettext.h
//
// 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 BOOSTER_LOCLAE_GNU_GETTEXT_HPP
#define BOOSTER_LOCLAE_GNU_GETTEXT_HPP
#include <booster/locale/message.h>
#include <booster/function.h>
#include <booster/backtrace.h>
namespace booster {
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<>
BOOSTER_API message_format<char> *create_messages_facet(messages_info const &info);
template<>
BOOSTER_API message_format<wchar_t> *create_messages_facet(messages_info const &info);
#ifdef BOOSTER_HAS_CHAR16_T
template<>
BOOSTER_API message_format<char16_t> *create_messages_facet(messages_info const &info);
#endif
#ifdef BOOSTER_HAS_CHAR32_T
template<>
BOOSTER_API 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
booster::locale::gnu_gettext::messages_info::callback
callback_type callback
Definition: gnu_gettext.h:125
booster::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.h:43
booster::locale::gnu_gettext::messages_info::domain::operator==
bool operator==(domain const &other) const
Definition: gnu_gettext.h:83
booster::locale::gnu_gettext::messages_info::domain
This type represents GNU Gettext domain name for the messages.
Definition: gnu_gettext.h:55
booster::locale::gnu_gettext::messages_info::language
std::string language
The language we load the catalog for, like "ru", "en", "de".
Definition: gnu_gettext.h:41
booster::locale::message_format
This facet provides message formatting abilities.
Definition: message.h:47
booster::locale::gnu_gettext::messages_info::locale_category
std::string locale_category
Definition: gnu_gettext.h:46
booster::locale::gnu_gettext::messages_info::country
std::string country
The country we load the catalog for, like "US", "IL".
Definition: gnu_gettext.h:42
booster::locale::gnu_gettext::messages_info::domain::name
std::string name
The name of the domain.
Definition: gnu_gettext.h:57
booster::locale::gnu_gettext::messages_info::encoding
std::string encoding
Definition: gnu_gettext.h:44
booster::locale::gnu_gettext::messages_info::domains_type
std::vector< domain > domains_type
Definition: gnu_gettext.h:97
booster::locale::gnu_gettext::create_messages_facet
message_format< CharType > * create_messages_facet(messages_info const &info)
booster::locale::gnu_gettext::messages_info::domains
domains_type domains
Definition: gnu_gettext.h:99
booster::locale::gnu_gettext::messages_info::paths
std::vector< std::string > paths
Definition: gnu_gettext.h:101
booster::locale::gnu_gettext::messages_info::domain::domain
domain(std::string const &n)
Definition: gnu_gettext.h:66
booster::function
Definition: function.h:16
booster::locale::info
a facet that holds general information about locale
Definition: info.h:27
booster::locale::gnu_gettext::messages_info
This structure holds all information required for creating gnu-gettext message catalogs,.
Definition: gnu_gettext.h:34
booster::locale::gnu_gettext::messages_info::domain::encoding
std::string encoding
The character encoding for the domain.
Definition: gnu_gettext.h:58
booster::locale::gnu_gettext::messages_info::domain::operator!=
bool operator!=(domain const &other) const
Definition: gnu_gettext.h:90