CppCMS
|
the major class used for locale generation More...
#include <booster/booster/locale/generator.h>
Public Member Functions | |
generator () | |
generator (localization_backend_manager const &) | |
void | categories (locale_category_type cats) |
locale_category_type | categories () const |
void | characters (character_facet_type chars) |
character_facet_type | characters () const |
void | add_messages_domain (std::string const &domain) |
void | set_default_messages_domain (std::string const &domain) |
void | clear_domains () |
void | add_messages_path (std::string const &path) |
void | clear_paths () |
void | clear_cache () |
void | locale_cache_enabled (bool on) |
bool | locale_cache_enabled () const |
bool | use_ansi_encoding () const |
void | use_ansi_encoding (bool enc) |
std::locale | generate (std::string const &id) const |
std::locale | generate (std::locale const &base, std::string const &id) const |
std::locale | operator() (std::string const &id) const |
void | set_option (std::string const &name, std::string const &value) |
void | clear_options () |
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.
Create new generator using global localization_backend_manager
Create new generator using specific localization_backend_manager
void booster::locale::generator::add_messages_domain | ( | std::string const & | 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 booster::locale::generator::add_messages_path | ( | std::string const & | path | ) |
Add a search path where dictionaries are looked in.
Set types of facets that should be generated, default all
Get types of facets that should be generated, default all
void booster::locale::generator::characters | ( | character_facet_type | chars | ) |
Set the characters type for which the facets should be generated, default all supported
Get the characters type for which the facets should be generated, default all supported
Remove all cached locales
Remove all added domains from the list
Clear backend specific options
Remove all added paths
std::locale booster::locale::generator::generate | ( | std::string const & | id | ) | const |
Generate a locale with id id
std::locale booster::locale::generator::generate | ( | std::locale const & | base, |
std::string const & | 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 booster::locale::generator::locale_cache_enabled | ( | bool | on | ) |
Turn locale caching ON
bool booster::locale::generator::locale_cache_enabled | ( | ) | const |
Get locale cache option
std::locale booster::locale::generator::operator() | ( | std::string const & | id | ) | const [inline] |
Shortcut to generate(id)
void booster::locale::generator::set_default_messages_domain | ( | std::string const & | 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 booster::locale::generator::set_option | ( | std::string const & | name, |
std::string const & | value | ||
) |
Set backend specific option
bool booster::locale::generator::use_ansi_encoding | ( | ) | const |
Check if by default ANSI encoding is selected or UTF-8 onces. The default is false.
void booster::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