Package com.google.gwt.i18n.client
Class LocaleInfo
- java.lang.Object
-
- com.google.gwt.i18n.client.LocaleInfo
-
public class LocaleInfo extends java.lang.Object
Provides access to the currently-active locale and the list of available locales.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
LocaleInfo()
Constructor to be used by subclasses, such as mock classes for testing.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String[]
getAvailableLocaleNames()
Returns an array of available locale names.static LocaleInfo
getCurrentLocale()
Returns a LocaleInfo instance for the current locale.DateTimeConstants
getDateTimeConstants()
Returns a DateTimeConstants instance for this locale.DateTimeFormatInfo
getDateTimeFormatInfo()
Returns a DateTimeConstants instance for this locale.static java.lang.String
getLocaleCookieName()
Returns the name of the name of the cookie holding the locale to use, which is defined in the config propertylocale.cookie
.java.lang.String
getLocaleName()
Returns the name of this locale, such as "default, "en_US", etc.static java.lang.String
getLocaleNativeDisplayName(java.lang.String localeName)
Returns the display name of the requested locale in its native locale, if possible.static java.lang.String
getLocaleQueryParam()
Returns the name of the query parameter holding the locale to use, which is defined in the config propertylocale.queryparam
.LocalizedNames
getLocalizedNames()
NumberConstants
getNumberConstants()
Returns a NumberConstants instance for this locale.static boolean
hasAnyRTL()
Returns true if any locale supported by this build of the app is RTL.boolean
isRTL()
Returns true if this locale is right-to-left instead of left-to-right.
-
-
-
Method Detail
-
getAvailableLocaleNames
public static final java.lang.String[] getAvailableLocaleNames()
Returns an array of available locale names.
-
getCurrentLocale
public static final LocaleInfo getCurrentLocale()
Returns a LocaleInfo instance for the current locale.
-
getLocaleCookieName
public static final java.lang.String 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
public static java.lang.String getLocaleNativeDisplayName(java.lang.String localeName)
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
public static java.lang.String 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
public final DateTimeConstants getDateTimeConstants()
Returns a DateTimeConstants instance for this locale.
-
getDateTimeFormatInfo
public final DateTimeFormatInfo getDateTimeFormatInfo()
Returns a DateTimeConstants instance for this locale.
-
getLocaleName
public final java.lang.String getLocaleName()
Returns the name of this locale, such as "default, "en_US", etc.
-
getLocalizedNames
public final LocalizedNames getLocalizedNames()
- Returns:
- an implementation of
LocalizedNames
for this locale.
-
getNumberConstants
public final NumberConstants 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.
-
-