Internationalization Module User’s Guide : Chapter 10 Locales and Localized Resources : Named Locales
Named Locales
In the Internationalization Module, a locale name consists of one or more of the following components, in the following order:
a two-letter, lowercase ISO-639 language code
an optional two-letter, uppercase ISO-3166 country code
an optional variant code representing variations within a language-country pair; the variant name may be compound, composed of two or more variants joined by an underbar
Multiple components are joined by underbars. For example, locale zh_TW contains the ISO-639 language code for Chinese and the ISO-3166 country code for Taiwan. Locale es_ES_TRADITIONAL uses a variant code to specify traditional Spanish.
Listing Language Codes
Class RWUIsoLanguageList constructs iterators that provide access to the static list of ISO-639 language codes recognized by the Internationalization Module. For example, you might use this class to display a list of language codes to an end user. The list cannot be changed at run time.
The static begin() and end() methods return standard iterators. This code constructs an iterator object, then iterates over the list of language codes and writes them to std::cout:
 
RWUIsoLanguageList::const_iterator iter;
 
for (iter = RWUIsoLanguageList::begin();
iter != RWUIsoLanguageList::end();
++iter) {
std::cout << *iter << std::endl;
}
RWUIsoLanguageList may also be instantiated to produce an object that allows easy access to the static methods:
 
RWUIsoLanguageList::const_iterator iter;
RWUIsoLanguageList list;
 
for (iter = list.begin(); iter != list.end(); ++iter) {
std::cout << *iter << std::endl;
}
NOTE >> The Internationalization Module does not recognize deprecated language codes.
Listing Country Codes
Class RWUIsoCountryList constructs iterators that provide access to the static list of ISO-3166 country codes recognized by the Internationalization Module. For example, you might use this class to display a list of country codes to an end user. The list cannot be changed at run time.
The static begin() and end() methods return standard iterators. This code constructs an iterator object, then iterates over the list of country codes and writes them to std::cout:
 
RWUIsoCountryList::const_iterator iter;
 
for (iter = RWUIsoCountryList::begin();
iter != RWUIsoCountryList::end();
++iter) {
std::cout << *iter << std::endl;
}
RWUIsoCountryList may also be instantiated to produce an object that allows easy access to the static methods:
 
RWUIsoCountryList::const_iterator iter;
RWUIsoCountryList list;
 
for (iter = list.begin(); iter != list.end(); ++iter) {
std::cout << *iter << std::endl;
}
NOTE >> The Internationalization Module does not recognize deprecated country codes.
Listing Available Locales
Class RWUAvailableLocaleList constructs RWUAvailableLocaleListIterator instances that provide access to the recognized list of locale names. The list cannot be changed at runtime.
The static begin() and end() methods return standard RWUAvailableLocaleListIterators. For example, this code constructs an iterator object, then iterates over the list of locales and writes them to std::cout:
 
RWUAvailableLocaleList::const_iterator iter;
 
for (iter = RWUAvailableLocaleList::begin();
iter != RWUAvailableLocaleList::end();
++iter) {
std::cout << *iter << std::endl;
}
RWUAvailableLocaleList may also be instantiated to produce an object that allows easy access to the static methods:
 
RWUAvailableLocaleList::const_iterator iter;
RWUAvailableLocaleList list;
for (iter = list.begin(); iter != list.end(); ++iter) {
std::cout << *iter << std::endl;
}