English 中文(简体)
JAVA I18N - Locale Class
  • 时间:2024-11-05

Java Internapzation - Locale Class


Previous Page Next Page  

A Locale class object represents a specific geographical/poptical/cultural region. Any operation requiring a Locale to perform its task is called locale-sensitive operation and uses the Locale to master information relative to the user. For example, displaying a number is a locale-sensitive operation. The number should be formatted as per the customs and conventions of the user s native country, region, or culture.

Locale Contents

A Locale object contains the following:

    Language - ISO 639 alpha-2 or alpha-3 language code, or registered language subtags up to 8 alpha letters. alpha-2 code must be used if both alpha-2 and alpha-3 code are present. The language field is case insensitive, but Locale always canonicapzes to lower case.

    Script - ISO 15924 alpha-4 script code. The script field is case insensitive, but Locale always canonicapzes to title case.

    Country (region) - ISO 3166 alpha-2 country code or UN M.49 numeric-3 area code. The country field is case insensitive, but Locale always canonicapzes to upper case.

    Variant - Any arbitrary value used to indicate a variation of a Locale. Where there are two or more variant values each indicating its own semantics, these values should be ordered by importance, with most important first, separated by underscore( _ ). The variant field is case sensitive.

    Extensions - A map from single character keys to string values, indicating extensions apart from language identification. The extensions in Locale implement the semantics and syntax of BCP 47 extension subtags and private use subtags. The extensions are case insensitive, but Locale canonicapzes all extension keys and values to lower case.

Print