Package com.google.gwt.i18n.server
Class GwtLocaleImpl
java.lang.Object
com.google.gwt.i18n.server.GwtLocaleImpl
- All Implemented Interfaces:
GwtLocale
,Comparable<GwtLocale>
Class representing GWT locales and conversion to/from other formats.
These locales correspond to BCP47.
-
Field Summary
Fields inherited from interface com.google.gwt.i18n.shared.GwtLocale
DEFAULT_LOCALE
-
Constructor Summary
ConstructorDescriptionGwtLocaleImpl
(GwtLocaleFactory factory, String language, String region, String script, String variant) Must only be called from a factory to preserve instance caching. -
Method Summary
Modifier and TypeMethodDescriptionint
The default comparison is a lexical ordering.boolean
Returns the list of aliases for this locale.Returns the locale as a fixed-format string suitable for use in searching for localized resources.Returns this locale in canonical form.Returns the complete list of locales to search for the current locale.Return a list of locales to search for, in order of preference.Returns the language portion of the locale, or null if none.Returns the language portion of the locale, or the empty string if none.Returns the region portion of the locale, or null if none.Returns the region portion of the locale, or the empty string if none.Returns the script portion of the locale, or null if none.Returns the script portion of the locale, or the empty string if none.Returns the variant portion of the locale, or null if none.Returns the variant portion of the locale, or the empty string if none.int
hashCode()
boolean
inheritsFrom
(GwtLocale parent) Return true if this locale inherits from the specified locale.boolean
Returns true if this is the default or root locale.toString()
Returns a human readable string -- "default" or the same as getAsString().boolean
usesSameScript
(GwtLocale other) Checks if this locale uses the same script as another locale, taking into account default scripts.
-
Constructor Details
-
Method Details
-
equals
-
getAliases
Description copied from interface:GwtLocale
Returns the list of aliases for this locale. The canonical form of the current locale is always first on the list. Language/region codes have changed over time, so some systems continue to use the older codes. Aliases allow GWT to use the official Unicode CLDR locales while still interoperating with such systems.- Specified by:
getAliases
in interfaceGwtLocale
- Returns:
- alias list
-
getAsString
Description copied from interface:GwtLocale
Returns the locale as a fixed-format string suitable for use in searching for localized resources. The format is language_Script_REGION_VARIANT, where language is a 2-8 letter code (possibly with 3-letter extensions), script is a 4-letter code with an initial capital letter, region is a 2-character country code or a 3-digit region code, and variant is a 5-8 character (may be 4 if the first character is numeric) code. If a component is missing, its preceding _ is also omitted. If this is the default locale, the empty string will be returned.- Specified by:
getAsString
in interfaceGwtLocale
- Returns:
- String representing locale
-
getCanonicalForm
Returns this locale in canonical form. Changes for canonical form are:- Deprecated language/region tags are replaced with official versions
- Specified by:
getCanonicalForm
in interfaceGwtLocale
- Returns:
- GwtLocale instance
-
getCompleteSearchList
Description copied from interface:GwtLocale
Returns the complete list of locales to search for the current locale. This list will always start with the canonical form of this locale, and end with "default", and include all appropriate aliases along the way.- Specified by:
getCompleteSearchList
in interfaceGwtLocale
- Returns:
- search list
-
getInheritanceChain
Return a list of locales to search for, in order of preference. The current locale is always first on the list. Aliases are not included in the list -- usegetAliases()
to expand those.- Specified by:
getInheritanceChain
in interfaceGwtLocale
- Returns:
- inheritance list
-
getLanguage
Description copied from interface:GwtLocale
Returns the language portion of the locale, or null if none.- Specified by:
getLanguage
in interfaceGwtLocale
-
getLanguageNotNull
Description copied from interface:GwtLocale
Returns the language portion of the locale, or the empty string if none.- Specified by:
getLanguageNotNull
in interfaceGwtLocale
-
getRegion
Description copied from interface:GwtLocale
Returns the region portion of the locale, or null if none. -
getRegionNotNull
Description copied from interface:GwtLocale
Returns the region portion of the locale, or the empty string if none.- Specified by:
getRegionNotNull
in interfaceGwtLocale
-
getScript
Description copied from interface:GwtLocale
Returns the script portion of the locale, or null if none. -
getScriptNotNull
Description copied from interface:GwtLocale
Returns the script portion of the locale, or the empty string if none.- Specified by:
getScriptNotNull
in interfaceGwtLocale
-
getVariant
Description copied from interface:GwtLocale
Returns the variant portion of the locale, or null if none.- Specified by:
getVariant
in interfaceGwtLocale
-
getVariantNotNull
Description copied from interface:GwtLocale
Returns the variant portion of the locale, or the empty string if none.- Specified by:
getVariantNotNull
in interfaceGwtLocale
-
hashCode
public int hashCode() -
isDefault
public boolean isDefault()Description copied from interface:GwtLocale
Returns true if this is the default or root locale. -
toString
Description copied from interface:GwtLocale
Returns a human readable string -- "default" or the same as getAsString().