Boost.Locale
|
the major class used for locale generation More...
#include <boost/locale/generator.hpp>
Public Member Functions | |
generator () | |
Create new generator using global localization_backend_manager. | |
generator (const localization_backend_manager &) | |
Create new generator using specific localization_backend_manager. | |
void | categories (category_t cats) |
Set types of facets that should be generated, default all. | |
category_t | categories () const |
Get types of facets that should be generated, default all. | |
void | characters (char_facet_t chars) |
Set the characters type for which the facets should be generated, default all supported. | |
char_facet_t | characters () const |
Get the characters type for which the facets should be generated, default all supported. | |
void | add_messages_domain (const std::string &domain) |
void | set_default_messages_domain (const std::string &domain) |
void | clear_domains () |
Remove all added domains from the list. | |
void | add_messages_path (const std::string &path) |
void | clear_paths () |
Remove all added paths. | |
void | clear_cache () |
Remove all cached locales. | |
void | locale_cache_enabled (bool on) |
Turn locale caching ON. | |
bool | locale_cache_enabled () const |
Get locale cache option. | |
bool | use_ansi_encoding () const |
Check if by default ANSI encoding is selected or UTF-8 onces. The default is false. | |
void | use_ansi_encoding (bool enc) |
std::locale | generate (const std::string &id) const |
Generate a locale with id id. | |
std::locale | generate (const std::locale &base, const std::string &id) const |
std::locale | operator() (const std::string &id) const |
Shortcut to generate(id) | |
the major class used for locale generation
This class is used for specification of all parameters required for locale generation and caching. This class const member functions are thread safe if locale class implementation is thread safe.
void boost::locale::generator::add_messages_domain | ( | const std::string & | domain | ) |
Add a new domain of messages that would be generated. It should be set in order to enable messages support.
Messages domain has following format: "name" or "name/encoding" where name is the base name of the "mo" file where the catalog is stored without ".mo" extension. For example for file /usr/share/locale/he/LC_MESSAGES/blog
.mo it would be blog
.
You can optionally specify the encoding of the keys in the sources by adding "/encoding_name" For example blog/cp1255.
If not defined all keys are assumed to be UTF-8 encoded.
void boost::locale::generator::add_messages_path | ( | const std::string & | path | ) |
Add a search path where dictionaries are looked in.
std::locale boost::locale::generator::generate | ( | const std::locale & | base, |
const std::string & | id | ||
) | const |
Generate a locale with id id. Use base as a locale to which all facets are added, instead of std::locale::classic().
void boost::locale::generator::set_default_messages_domain | ( | const std::string & | domain | ) |
Set default message domain. If this member was not called, the first added messages domain is used. If the domain domain is not added yet it is added.
void boost::locale::generator::use_ansi_encoding | ( | bool | enc | ) |
Select ANSI encodings as default system encoding rather then UTF-8 by default under Windows.
The default is the most portable and most powerful encoding, UTF-8, but the user can select "system" one if dealing with legacy applications