Class LocaleUtils

java.lang.Object
org.gwtproject.i18n.processor.LocaleUtils

public class LocaleUtils
extends java.lang.Object
Utility methods for dealing with locales.
  • Method Summary

    Modifier and Type Method Description
    java.util.Set<org.gwtproject.i18n.shared.GwtLocale> getAllCompileLocales()
    Returns the set of all compile-time locales.
    java.util.Set<org.gwtproject.i18n.shared.GwtLocale> getAllLocales()
    Returns the set of all available locales, whether compile-time locales or runtime locales.
    org.gwtproject.i18n.shared.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​(javax.annotation.processing.Messager logger, PropertyOracle propertyOracle, ProcessorContext context)
    Create a new LocaleUtils instance for the given PropertyOracle.
    static org.gwtproject.i18n.shared.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<org.gwtproject.i18n.shared.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
  • Method Details

    • getInstance

      public static LocaleUtils getInstance​(javax.annotation.processing.Messager logger, PropertyOracle propertyOracle, ProcessorContext 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 org.gwtproject.i18n.shared.GwtLocaleFactory getLocaleFactory()
      Get a shared GwtLocale factory so instances are cached between all uses.
      Returns:
      singleton GwtLocaleFactory instance.
    • getAllCompileLocales

      public java.util.Set<org.gwtproject.i18n.shared.GwtLocale> getAllCompileLocales()
      Returns the set of all compile-time locales.
      Returns:
      unmodifiable set of all compile-time locales
    • getAllLocales

      public java.util.Set<org.gwtproject.i18n.shared.GwtLocale> getAllLocales()
      Returns the set of all available locales, whether compile-time locales or runtime locales.
      Returns:
      unmodifiable set of all locales
    • getCompileLocale

      public org.gwtproject.i18n.shared.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<org.gwtproject.i18n.shared.GwtLocale> getRuntimeLocales()
      Returns a list of locales which are children of the current compile-time locale.
      Returns:
      unmodifiable list of matching locales