CppCMS
Public Member Functions
booster::locale::generator Class Reference

the major class used for locale generation More...

#include <booster/booster/locale/generator.h>

List of all members.

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 ()

Detailed Description

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.


Constructor & Destructor Documentation

Create new generator using global localization_backend_manager

Create new generator using specific localization_backend_manager


Member Function Documentation

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.

Note:
When you select a domain for the program using dgettext or message API, you do not specify the encoding part. So for example if the provided domain name was "blog/windows-1255" then for translation you should use dgettext("blog","Hello")
void booster::locale::generator::add_messages_path ( std::string const &  path)

Add a search path where dictionaries are looked in.

Note:
  • Under the Windows platform the path is treated as a path in the locale's encoding so if you create locale "en_US.windows-1251" then path would be treated as cp1255, and if it is en_US.UTF-8 it is treated as UTF-8. File name is always opened with a wide file name as wide file names are the native file name on Windows.
  • Under POSIX platforms all paths passed as-is regardless of encoding as narrow encodings are the native encodings for POSIX platforms.

Set types of facets that should be generated, default all

Get types of facets that should be generated, default all

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().

Turn locale caching ON

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

Check if by default ANSI encoding is selected or UTF-8 onces. The default is false.

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


The documentation for this class was generated from the following file: