Package com.google.gwt.i18n.client
Class LocaleInfo
java.lang.Object
com.google.gwt.i18n.client.LocaleInfo
Provides access to the currently-active locale and the list of available
locales.
-
Constructor Summary
ModifierConstructorDescriptionprotected
Constructor to be used by subclasses, such as mock classes for testing. -
Method Summary
Modifier and TypeMethodDescriptionstatic final String[]
Returns an array of available locale names.static final LocaleInfo
Returns a LocaleInfo instance for the current locale.final DateTimeConstants
Returns a DateTimeConstants instance for this locale.final DateTimeFormatInfo
Returns a DateTimeConstants instance for this locale.static final String
Returns the name of the name of the cookie holding the locale to use, which is defined in the config propertylocale.cookie
.final String
Returns the name of this locale, such as "default, "en_US", etc.static String
getLocaleNativeDisplayName
(String localeName) Returns the display name of the requested locale in its native locale, if possible.static String
Returns the name of the query parameter holding the locale to use, which is defined in the config propertylocale.queryparam
.final LocalizedNames
final NumberConstants
Returns a NumberConstants instance for this locale.static boolean
Returns true if any locale supported by this build of the app is RTL.final boolean
isRTL()
Returns true if this locale is right-to-left instead of left-to-right.
-
Constructor Details
-
LocaleInfo
protected LocaleInfo()Constructor to be used by subclasses, such as mock classes for testing. Any such subclass should override all methods.
-
-
Method Details
-
getAvailableLocaleNames
Returns an array of available locale names. -
getCurrentLocale
Returns a LocaleInfo instance for the current locale. -
getLocaleCookieName
Returns the name of the name of the cookie holding the locale to use, which is defined in the config propertylocale.cookie
.- Returns:
- locale cookie name, or null if none
-
getLocaleNativeDisplayName
Returns the display name of the requested locale in its native locale, if possible. If no native localization is available, the English name will be returned, or as a last resort just the locale name will be returned. If the locale name is unknown (including an user overrides) or is not a valid locale property value, null is returned. If the I18N module has not been imported, this will always return null.- Parameters:
localeName
- the name of the locale to lookup.- Returns:
- the name of the locale in its native locale
-
getLocaleQueryParam
Returns the name of the query parameter holding the locale to use, which is defined in the config propertylocale.queryparam
.- Returns:
- locale URL query parameter name, or null if none
-
hasAnyRTL
public static boolean hasAnyRTL()Returns true if any locale supported by this build of the app is RTL. -
getDateTimeConstants
Returns a DateTimeConstants instance for this locale. -
getDateTimeFormatInfo
Returns a DateTimeConstants instance for this locale. -
getLocaleName
Returns the name of this locale, such as "default, "en_US", etc. -
getLocalizedNames
- Returns:
- an implementation of
LocalizedNames
for this locale.
-
getNumberConstants
Returns a NumberConstants instance for this locale. -
isRTL
public final boolean isRTL()Returns true if this locale is right-to-left instead of left-to-right.
-