Classes | |
struct | i18n::locale_t |
simple struct for managing a locale specification More... | |
class | i18n::Manager |
Functions | |
i18n::locale_t::locale_t (void) throw () | |
void | i18n::locale_t::clear (void) throw () |
const char * | i18n::locale_t::getString (void) const throw () |
bool | i18n::locale_t::isValid (void) const throw () |
is this a valid locale? | |
const char * | i18n::locale_t::getLanguageCode (OUT char *buffer) const throw () |
NOTE: for now we use ISO 639-1 (2-character language codes), but in the future this library could use ISO 639-2 (3-character codes) if they become common enough. | |
const char * | i18n::locale_t::getCountryCode (OUT char *buffer) const throw () |
const char * | i18n::locale_t::getEncoding (OUT char *buffer) const throw () |
virtual const char * | i18n::Manager::getLocale (void) const =0 throw () |
virtual void | i18n::Manager::parseStrings (IN nstream::Stream *stream)=0 |
given a named stream (nstream::Stream), parses all localeInfo blocks relevant to this Manager's locale. | |
virtual void | i18n::Manager::parseFolder (IN nstream::Folder *folder, IN const SetString *extensions=NULL, IN const char *filter=NULL)=0 |
recursively walks all child Entries beneath the specified Folder, and calls parseStrings() on each. | |
virtual const char * | i18n::Manager::getString (IN const char *id) const =0 throw () |
retrieves the specified string. | |
static smart_ptr< Manager > | i18n::Manager::create (IN const char *locale) |
void | i18n::getLocaleFromString (IN const char *localeString, OUT locale_t &locale) |
given a locale string, of the form "xx_yy.zzzz", returns a locale_t
| |
bool | i18n::isValidCountryCode (IN const char *country_code) |
is this a valid country code? Based on ISO 3166 | |
bool | i18n::isValidLanguageCode (IN const char *language_code) |
is this a valid language code? Only supports ISO 639-1 (2-character codes) for now. | |
bool | i18n::isValidEncoding (IN const char *encoding) |
is this a valid encoding? "valid" means "supported by this library", which for right now is just "UTF-8" | |
const char * | i18n::getString (IN const Manager *mgr, IN const char *id) |
returns the string from the given Manager. | |
const char * | i18n::getHostLocale (void) |
attempt to determine the local host locale. Can return NULL! | |
Variables | |
char | i18n::locale_t::string [eMaxLength+1] |
i18n::locale_t::locale_t | ( | void | ) | throw () [inline, inherited] |
void i18n::locale_t::clear | ( | void | ) | throw () [inline, inherited] |
const char* i18n::locale_t::getString | ( | void | ) | const throw () [inline, inherited] |
bool i18n::locale_t::isValid | ( | void | ) | const throw () [inherited] |
const char* i18n::locale_t::getLanguageCode | ( | OUT char * | buffer | ) | const throw () [inline, inherited] |
NOTE: for now we use ISO 639-1 (2-character language codes), but in the future this library could use ISO 639-2 (3-character codes) if they become common enough.
Client code should use the locale_t::eBufferSize constant to construct character buffer arrays, to remain forward compatible.
const char* i18n::locale_t::getCountryCode | ( | OUT char * | buffer | ) | const throw () [inline, inherited] |
const char* i18n::locale_t::getEncoding | ( | OUT char * | buffer | ) | const throw () [inline, inherited] |
virtual const char* i18n::Manager::getLocale | ( | void | ) | const throw () [pure virtual, inherited] |
virtual void i18n::Manager::parseStrings | ( | IN nstream::Stream * | stream | ) | [pure virtual, inherited] |
given a named stream (nstream::Stream), parses all localeInfo blocks relevant to this Manager's locale.
virtual void i18n::Manager::parseFolder | ( | IN nstream::Folder * | folder, | |
IN const SetString * | extensions = NULL , |
|||
IN const char * | filter = NULL | |||
) | [pure virtual, inherited] |
recursively walks all child Entries beneath the specified Folder, and calls parseStrings() on each.
Caller can provide a filter (only Entries whose full path includes the filter as a substring will be visited). For many projects, the locale name can be used as a filter (since filenames/paths will include the locale specifier). The caller can also (optionally) provide a set of valid filename extensions. Skips files and directories beginning with a dot ('.').
virtual const char* i18n::Manager::getString | ( | IN const char * | id | ) | const throw () [pure virtual, inherited] |
retrieves the specified string.
Returns null if ID is not recognized.
smart_ptr< Manager > i18n::Manager::create | ( | IN const char * | locale | ) | [static, inherited] |
void i18n::getLocaleFromString | ( | IN const char * | localeString, | |
OUT locale_t & | locale | |||
) |
given a locale string, of the form "xx_yy.zzzz", returns a locale_t
bool i18n::isValidCountryCode | ( | IN const char * | code | ) |
is this a valid country code? Based on ISO 3166
bool i18n::isValidLanguageCode | ( | IN const char * | language_code | ) |
is this a valid language code? Only supports ISO 639-1 (2-character codes) for now.
bool i18n::isValidEncoding | ( | IN const char * | encoding | ) |
is this a valid encoding? "valid" means "supported by this library", which for right now is just "UTF-8"
const char * i18n::getString | ( | IN const Manager * | mgr, | |
IN const char * | id | |||
) |
returns the string from the given Manager.
If the string isn't found, a general (probably English) error message is returned instead. This is handy if a missing string isn't fatal and you don't need richer error messaging. This will help missing strings be identified by the user.
const char * i18n::getHostLocale | ( | void | ) |
attempt to determine the local host locale. Can return NULL!
char i18n::locale_t::string[eMaxLength+1] [inherited] |