com.google.gwt.i18n.rebind

## Class LocaleUtils

- java.lang.Object
- - com.google.gwt.i18n.rebind.LocaleUtils

-     public class LocaleUtils
      extends java.lang.Object

  Utility methods for dealing with locales.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) static java.lang.String` | `PROP_LOCALE` The token representing the locale property controlling Localization.
    `(package private) static java.lang.String` | `PROP_LOCALE_COOKIE` The config property identifying the cookie name to possibly get the value of the locale property.
    `(package private) static java.lang.String` | `PROP_LOCALE_QUERY_PARAM` The config property identifying the URL query parameter name to possibly get the value of the locale property.
    `(package private) static java.lang.String` | `PROP_RUNTIME_LOCALES` The token representing the runtime.locales configuration property.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.Set<GwtLocale>` | `getAllCompileLocales()` Returns the set of all compile-time locales.
    `java.util.Set<GwtLocale>` | `getAllLocales()` Returns the set of all available locales, whether compile-time locales or runtime locales.
    `GwtLocale` | `getCompileLocale()` Returns the static compile-time locale for this permutation.
    `java.lang.String` | `getCookie()` 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` | `getLocaleFactory()` Get a shared GwtLocale factory so instances are cached between all uses.
    `java.lang.String` | `getQueryParam()` Return the name of the URL query param to potentially get the locale value from.
    `java.util.Set<GwtLocale>` | `getRuntimeLocales()` Returns a list of locales which are children of the current compile-time locale.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### PROP_LOCALE

          static final java.lang.String PROP_LOCALE

      The token representing the locale property controlling Localization.
      See Also:
        Constant Field Values

    - #### PROP_LOCALE_QUERY_PARAM

          static final java.lang.String PROP_LOCALE_QUERY_PARAM

      The config property identifying the URL query parameter name to possibly get the value of the locale property.
      See Also:
        Constant Field Values

    - #### PROP_LOCALE_COOKIE

          static final java.lang.String PROP_LOCALE_COOKIE

      The config property identifying the cookie name to possibly get the value of the locale property.
      See Also:
        Constant Field Values

    - #### PROP_RUNTIME_LOCALES

          static final java.lang.String PROP_RUNTIME_LOCALES

      The token representing the runtime.locales configuration property.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### 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

          public static GwtLocaleFactory getLocaleFactory()

      Get a shared GwtLocale factory so instances are cached between all uses.
      Returns:
        singleton GwtLocaleFactory instance.

    - #### getAllCompileLocales

          public java.util.Set<GwtLocale> getAllCompileLocales()

      Returns the set of all compile-time locales.
      Returns:
        unmodifiable set of all compile-time locales

    - #### getAllLocales

          public java.util.Set<GwtLocale> getAllLocales()

      Returns the set of all available locales, whether compile-time locales or runtime locales.
      Returns:
        unmodifiable set of all locales

    - #### getCompileLocale

          public GwtLocale getCompileLocale()

      Returns the static compile-time locale for this permutation.

    - #### getCookie

          public java.lang.String getCookie()

      Return the name of the cookie to potentially get the locale value from.
      Returns:
        the cookie name or null if none

    - #### getQueryParam

          public java.lang.String 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

          public java.util.Set<GwtLocale> getRuntimeLocales()

      Returns a list of locales which are children of the current compile-time locale.
      Returns:
        unmodifiable list of matching locales