public class

LocaleInfo

extends Object
java.lang.Object
   ↳ com.google.gwt.i18n.client.LocaleInfo

Class Overview

Provides access to the currently-active locale and the list of available locales.

Summary

Protected Constructors
LocaleInfo()
Constructor to be used by subclasses, such as mock classes for testing.
Public Methods
final static String[] getAvailableLocaleNames()
Returns an array of available locale names.
final static LocaleInfo getCurrentLocale()
Returns a LocaleInfo instance for the current locale.
final DateTimeConstants getDateTimeConstants()
Returns a DateTimeConstants instance for this locale.
final DateTimeFormatInfo getDateTimeFormatInfo()
Returns a DateTimeConstants instance for this locale.
final static String getLocaleCookieName()
Returns the name of the name of the cookie holding the locale to use, which is defined in the config property locale.cookie.
final String getLocaleName()
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 getLocaleQueryParam()
Returns the name of the query parameter holding the locale to use, which is defined in the config property locale.queryparam.
final LocalizedNames getLocalizedNames()
final 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.
final boolean isRTL()
Returns true if this locale is right-to-left instead of left-to-right.
[Expand]
Inherited Methods
From class java.lang.Object

Protected Constructors

protected LocaleInfo ()

Constructor to be used by subclasses, such as mock classes for testing. Any such subclass should override all methods.

Public Methods

public static final String[] getAvailableLocaleNames ()

Returns an array of available locale names.

public static final LocaleInfo getCurrentLocale ()

Returns a LocaleInfo instance for the current locale.

public final DateTimeConstants getDateTimeConstants ()

Returns a DateTimeConstants instance for this locale.

public final DateTimeFormatInfo getDateTimeFormatInfo ()

Returns a DateTimeConstants instance for this locale.

public static final String getLocaleCookieName ()

Returns the name of the name of the cookie holding the locale to use, which is defined in the config property locale.cookie.

Returns
  • locale cookie name, or null if none

public final String getLocaleName ()

Returns the name of this locale, such as "default, "en_US", etc.

public static String getLocaleNativeDisplayName (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

public static String getLocaleQueryParam ()

Returns the name of the query parameter holding the locale to use, which is defined in the config property locale.queryparam.

Returns
  • locale URL query parameter name, or null if none

public final LocalizedNames getLocalizedNames ()

Returns

public final NumberConstants getNumberConstants ()

Returns a NumberConstants instance for this locale.

public static boolean hasAnyRTL ()

Returns true if any locale supported by this build of the app is RTL.

public final boolean isRTL ()

Returns true if this locale is right-to-left instead of left-to-right.