Locale

from Wikipedia, the free encyclopedia

The locale is a set of settings that contains the locale (location) parameters for computer programs .

This primarily includes the language of the user interface , the country and settings for the character set , keyboard layout , number , currency , date and time formats . A set of settings is usually uniquely identified with a code that usually includes language and country.

There are different concepts for area settings in different operating systems :

Windows

Under Microsoft Windows , locale parameters are addressed by a number (e.g. 0x0407 for German or 0x0409 for English / US, other country codes via the web link) and contain data on display formats, code pages and keyboard layouts. Windows programs can only be translated without knowledge of the program source text if the information to be localized (character strings, window layouts, menus, images, etc.) is saved as program resources . As a rule, the original translation is lost.

.NET

In Microsoft's .NET Framework applications , locale-dependent inputs and outputs are controlled via the System.Globalization.CultureInfo class , whereby that of the underlying operating system is used by default. Location settings are identified with a language and country identifier, e.g. B. de-DEor en-US. The texts for locale-dependent user interfaces can in turn be adapted using resource XML files ( .resx ).

POSIX

On POSIX platforms, the translation functions are implemented using the 'Locale' functions in the standard C library and are therefore available in a large number of programs. The locale is set via the environment variables LANGand LC_*(e.g. LC_TIMEfor the date format) and can therefore differ from user to user and even from process to process. The locale names usually have the format [language[_territory][.codeset][@modifier]]. The language and area are represented by two- or three-digit ISO-639 or two-digit ISO-3166 codes (e.g. de_DEfor German / Germany, de_ATfor German / Austria or gsw_CHfor Swiss-German / Switzerland). The modifier is intended to select category-specific variants, e.g. B. a currency, a date format or a sort order. In practice, however, this option is usually not available due to the lack of predefined locales.

Mac OS X

Under Mac OS X you can set location settings and other parameters in ~ / .MacOSX / environment.plist, in the following example to UTF-8:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LC_ALL</key>
<string>de_DE.UTF-8</string>
</dict>
</plist>

If the file does not exist, the directory and file can simply be created.

Java

The Java platform maps 'Locale' functions via the class java.util.Locale. Location settings are identified here with a label consisting of language and country (e.g. de_DEfor German / Germany or de_ATfor German / Austria). In addition, the Variant attribute can be used to refer to regions (see also ISO 3166-2: AT , ISO 3166-2: CH , ISO 3166-2: DE ). The internationalization or localization takes place on the basis of so-called ResourceBundles ("resource bundles"), which java.util.ResourceBundleare mapped in Java with the class .

CLDR

The Common Locale Data Repository is a project that provides locales for many languages ​​and can be used in different programming languages ​​via libraries .

See also

Web links