A class representing a locale.
Instances of this class represent locales. Locales are typically instantiated with a 2 character ISO-639-1 language code and a 2 character ISO-3166-1 country code though it is possible to default construct a locale. Additionally, this class manages the global locale.
#include <utility/YiLocale.h>

Public Member Functions | |
| CYILocale () | |
| CYILocale (const CYIString &rLanguageCode, const CYIString &rCountryCode) | |
| virtual | ~CYILocale () |
| const CYIString & | GetLanguageCode () const |
| const CYIString & | GetCountryCode () const |
| CYIString | ToString () const |
Public Member Functions inherited from CYIScriptableObject | |
| CYIScriptableObject () | |
| CYIScriptableObject (const CYIScriptableObject &other) | |
| CYIScriptableObject & | operator= (const CYIScriptableObject &other) |
| virtual | ~CYIScriptableObject () |
| CYIBindingImplementation * | GetBindingImplementation () const |
| void | SetBindingImplementation (CYIBindingImplementation *pBindingImplementation) |
| virtual const CYIRuntimeTypeInfo * | GetRuntimeTypeInfoForScriptObject () const |
Static Public Member Functions | |
| static const CYILocale & | GetLocale () |
| static void | SetLocale (const CYILocale &rLocale) |
| static const CYIString & | CountryCodeAlpha3ToAlpha2 (const CYIString &country) |
Protected Attributes | |
| CYIString | m_LanguageCode |
| CYIString | m_CountryCode |
| CYILocale::CYILocale | ( | ) |
Constructs an empty locale.
Constructs a locale with the given language and country codes. The language code should be a valid 2 character ISO-639-1 code and the country code should be a valid 2 character ISO-3166-1 code. No validation on the codes is performed.
|
virtual |
Destroys the locale.
Converts an ISO 3166-1 alpha 3 country code, country, to an ISO 3166-1 alpha 2 country code.
| const CYIString& CYILocale::GetCountryCode | ( | ) | const |
Returns the country code if the locale has one and an empty string otherwise. If the locale has a country code it is usually a 2 character ISO-3166-1 code but this is not guaranteed.
| const CYIString& CYILocale::GetLanguageCode | ( | ) | const |
Returns the language code if the locale has one and an empty string otherwise. If the locale has a language code it is usually a 2 character ISO-639-1 code but this is not guaranteed.
|
static |
Returns the global locale.
|
static |
Sets the global locale.
| CYIString CYILocale::ToString | ( | ) | const |
Returns a string representation of the locale or an empty string if the language or country codes (or both) are missing. The string representation is in the form of "en_US" where en is the language code (English) and US is the country code (United States).
|
protected |
|
protected |