Package com.google.gwt.i18n.rebind
Class LocaleUtils
java.lang.Object
com.google.gwt.i18n.rebind.LocaleUtils
Utility methods for dealing with locales.
-
Field Summary
Modifier and TypeFieldDescription(package private) static final String
The token representing the locale property controlling Localization.(package private) static final String
The config property identifying the cookie name to possibly get the value of the locale property.(package private) static final String
The config property identifying the URL query parameter name to possibly get the value of the locale property.(package private) static final String
The token representing the runtime.locales configuration property. -
Method Summary
Modifier and TypeMethodDescriptionReturns the set of all compile-time locales.Returns the set of all available locales, whether compile-time locales or runtime locales.Returns the static compile-time locale for this permutation.Return the name of the cookie to potentially get the locale value from.static LocaleUtils
getInstance
(TreeLogger logger, PropertyOracle propertyOracle, GeneratorContext context) Create a new LocaleUtils instance for the given PropertyOracle.static GwtLocaleFactory
Get a shared GwtLocale factory so instances are cached between all uses.Return the name of the URL query param to potentially get the locale value from.Returns a list of locales which are children of the current compile-time locale.
-
Field Details
-
PROP_LOCALE
The token representing the locale property controlling Localization.- See Also:
-
PROP_LOCALE_QUERY_PARAM
The config property identifying the URL query parameter name to possibly get the value of the locale property.- See Also:
-
PROP_LOCALE_COOKIE
The config property identifying the cookie name to possibly get the value of the locale property.- See Also:
-
PROP_RUNTIME_LOCALES
The token representing the runtime.locales configuration property.- See Also:
-
-
Method Details
-
getInstance
public static LocaleUtils getInstance(TreeLogger logger, PropertyOracle propertyOracle, GeneratorContext context) Create a new LocaleUtils instance for the given PropertyOracle. Returned instances will be immutable and can be shared across threads.- Parameters:
logger
-propertyOracle
-- Returns:
- LocaleUtils instance
-
getLocaleFactory
Get a shared GwtLocale factory so instances are cached between all uses.- Returns:
- singleton GwtLocaleFactory instance.
-
getAllCompileLocales
Returns the set of all compile-time locales.- Returns:
- unmodifiable set of all compile-time locales
-
getAllLocales
Returns the set of all available locales, whether compile-time locales or runtime locales.- Returns:
- unmodifiable set of all locales
-
getCompileLocale
Returns the static compile-time locale for this permutation. -
getCookie
Return the name of the cookie to potentially get the locale value from.- Returns:
- the cookie name or null if none
-
getQueryParam
Return the name of the URL query param to potentially get the locale value from.- Returns:
- the URL query param or null if none
-
getRuntimeLocales
Returns a list of locales which are children of the current compile-time locale.- Returns:
- unmodifiable list of matching locales
-