Classes | Enumerator | Functions | Variables

Internationalization (i18n) Library
[General Utility Libraries]

Collaboration diagram for Internationalization (i18n) Library:

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

  • xx: 2 character language code (ISO 639-1)
  • yy: 2 character country code (ISO 3166)
  • zzzz: encoding (arbitrary length, only "UTF-8" is supported right now)

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]

Function Documentation

i18n::locale_t::locale_t ( void   )  throw () [inline, inherited]

Definition at line 66 of file i18n.h.

void i18n::locale_t::clear ( void   )  throw () [inline, inherited]

Definition at line 67 of file i18n.h.

const char* i18n::locale_t::getString ( void   )  const throw () [inline, inherited]

Definition at line 73 of file i18n.h.

bool i18n::locale_t::isValid ( void   )  const throw () [inherited]

is this a valid locale?

Definition at line 194 of file i18n.cpp.

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.

Definition at line 83 of file i18n.h.

const char* i18n::locale_t::getCountryCode ( OUT char *  buffer  )  const throw () [inline, inherited]

Definition at line 91 of file i18n.h.

const char* i18n::locale_t::getEncoding ( OUT char *  buffer  )  const throw () [inline, inherited]

Definition at line 99 of file i18n.h.

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.

static 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

  • xx: 2 character language code (ISO 639-1)
  • yy: 2 character country code (ISO 3166)
  • zzzz: encoding (arbitrary length, only "UTF-8" is supported right now)

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.

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!


Variable Documentation

char i18n::locale_t::string[eMaxLength+1] [inherited]

Definition at line 106 of file i18n.h.