Views Locale Support
Although locale names are system-dependent, and each system has its own way of identifying the locale information, Views supports a system-independent scheme for localization.
Views Locale Names
For Views to use locale-dependent information in a system-independent way, Views defines the concept of a Views locale, whose name is system-independent. This locale has the following format:
ll_TT.encoding
where:
ll is a two-letter, lowercase abbreviation of the language name.
TT is a two-letter, uppercase abbreviation of the territory name.
encoding is a string that identifies the code set or encoding method used.
For example, in the Views locale name fr_FR.ISO‑8859‑1, the fr represents the language name, French; the FR represents the territory name, France; ISO‑8859‑1 represents the encoding method used for the language, which is ISO 8859‑1.
The following examples show several Views locale names on UNIX platforms:
* fr_FR.ISO-8859-1
* de_DE.ISO-8859-1
*ja_JP.EUC-JP
* ja_JP.Shift_JIS
The following examples show several Views locale names on Windows platforms:
*fr_FR.windows-1252
*de_DE.windows-1252
*ja_JP.Shift_JIS
Language Name Specification
In the Views locale, the language names are specified using the abbreviations from the ISO 639 Code for the Representation of Names of Languages. Here are several examples:
*en (English)
*fr (French)
*de (German, from “Deutsch”)
*ja (Japanese)
The ISO 639 standard can be consulted on the following Web sites:
http://www.loc.gov/standards/iso639-2/ascii_8bits.html
or ftp://std.dkuug.dk/i18n/iso-639-2.txt
More generally, ISO codes can be consulted on the following Web site:
http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_639.html
Territory Name Specification
In the Views locale, the territory names are specified using the abbreviations from the ISO 3166 Codes for the Representation of Names of Countries.
The ISO 3166 standard can be consulted on the following Web site:
http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm
Here are several examples:
*US (United States)
*NL (the Netherlands)
*FR (France)
*DE (Germany, from “Deutschland”)
*JP (Japan)
Encoding Specification
In the Views locale, the encoding identifies the code set or encoding method used for the language. Examples of encoding methods are:
*ISO-8859-1 (ISO 8859/1)
*Shift_JIS (Shift Japanese Industrial Standard)
Any character encoding registered by IANA could be used. Currently only character sets listed in Reference: Encoding Listingspage 236 are supported by Views, which tends to use the preferred MIME notation.
For more information, you can consult the following Web site:
http://www.iana.org/assignments/character-sets
Determining Views Support for the Locale
To determine if Views supports the desired locale, you can run the following program:
Note: This example uses private code that you should not use in a real application.
#include <ilviews/ilv.h>
#include <ilviews/base/locale.h>
 
int main(int argc, char* argv[])
{
if (!IlvSetLocale()) {
exit(1);
}
char* stdLocale = IlLocale::GetStdLocaleName(setlocale(LC_CTYPE, NULL));
if (stdLocale)
IlvPrint("Standard Views locale name: %s\n", stdLocale);
else
IlvPrint("Views does not support this locale.\n");
 
return 0;
}
For example, on an HP-UX system with your LANG set to fr_FR.iso88591 or on a Solaris system with your LANG set to fr, you get the following result:
Standard Views locale name: fr_FR.ISO-8859-1
On a Windows system set to Japanese, you get:
Standard Views locale name: ja_JP.Shift_JIS
Published date: 05/24/2022
Last modified date: 02/24/2022