Class GwtLocaleImpl

java.lang.Object
org.gwtproject.i18n.processor.GwtLocaleImpl
All Implemented Interfaces:
java.lang.Comparable<org.gwtproject.i18n.shared.GwtLocale>, org.gwtproject.i18n.shared.GwtLocale

public class GwtLocaleImpl
extends java.lang.Object
implements org.gwtproject.i18n.shared.GwtLocale
Class representing GWT locales and conversion to/from other formats.

These locales correspond to BCP47.

  • Field Summary

    Fields inherited from interface org.gwtproject.i18n.shared.GwtLocale

    DEFAULT_LOCALE
  • Method Summary

    Modifier and Type Method Description
    int compareTo​(org.gwtproject.i18n.shared.GwtLocale o)  
    boolean equals​(java.lang.Object obj)  
    java.util.List<org.gwtproject.i18n.shared.GwtLocale> getAliases()  
    java.lang.String getAsString()  
    org.gwtproject.i18n.shared.GwtLocale getCanonicalForm()
    Returns this locale in canonical form.
    java.util.List<org.gwtproject.i18n.shared.GwtLocale> getCompleteSearchList()  
    java.util.List<org.gwtproject.i18n.shared.GwtLocale> getInheritanceChain()
    Return a list of locales to search for, in order of preference.
    java.lang.String getLanguage()  
    java.lang.String getLanguageNotNull()  
    java.lang.String getRegion()  
    java.lang.String getRegionNotNull()  
    java.lang.String getScript()  
    java.lang.String getScriptNotNull()  
    java.lang.String getVariant()  
    java.lang.String getVariantNotNull()  
    int hashCode()  
    boolean inheritsFrom​(org.gwtproject.i18n.shared.GwtLocale parent)
    Return true if this locale inherits from the specified locale.
    boolean isDefault()  
    java.lang.String toString()  
    boolean usesSameScript​(org.gwtproject.i18n.shared.GwtLocale other)
    Checks if this locale uses the same script as another locale, taking into account default scripts.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Method Details

    • compareTo

      public int compareTo​(org.gwtproject.i18n.shared.GwtLocale o)
      Specified by:
      compareTo in interface java.lang.Comparable<org.gwtproject.i18n.shared.GwtLocale>
      Specified by:
      compareTo in interface org.gwtproject.i18n.shared.GwtLocale
    • equals

      public boolean equals​(java.lang.Object obj)
      Overrides:
      equals in class java.lang.Object
    • getAliases

      public java.util.List<org.gwtproject.i18n.shared.GwtLocale> getAliases()
      Specified by:
      getAliases in interface org.gwtproject.i18n.shared.GwtLocale
    • getAsString

      public java.lang.String getAsString()
      Specified by:
      getAsString in interface org.gwtproject.i18n.shared.GwtLocale
    • getCanonicalForm

      public org.gwtproject.i18n.shared.GwtLocale getCanonicalForm()
      Returns this locale in canonical form. Changes for canonical form are:
      • Deprecated language/region tags are replaced with official versions
      Specified by:
      getCanonicalForm in interface org.gwtproject.i18n.shared.GwtLocale
      Returns:
      GwtLocale instance
    • getCompleteSearchList

      public java.util.List<org.gwtproject.i18n.shared.GwtLocale> getCompleteSearchList()
      Specified by:
      getCompleteSearchList in interface org.gwtproject.i18n.shared.GwtLocale
    • getInheritanceChain

      public java.util.List<org.gwtproject.i18n.shared.GwtLocale> getInheritanceChain()
      Return a list of locales to search for, in order of preference. The current locale is always first on the list. Aliases are not included in the list -- use getAliases() to expand those.
      Specified by:
      getInheritanceChain in interface org.gwtproject.i18n.shared.GwtLocale
      Returns:
      inheritance list
    • getLanguage

      public java.lang.String getLanguage()
      Specified by:
      getLanguage in interface org.gwtproject.i18n.shared.GwtLocale
    • getLanguageNotNull

      public java.lang.String getLanguageNotNull()
      Specified by:
      getLanguageNotNull in interface org.gwtproject.i18n.shared.GwtLocale
    • getRegion

      public java.lang.String getRegion()
      Specified by:
      getRegion in interface org.gwtproject.i18n.shared.GwtLocale
    • getRegionNotNull

      public java.lang.String getRegionNotNull()
      Specified by:
      getRegionNotNull in interface org.gwtproject.i18n.shared.GwtLocale
    • getScript

      public java.lang.String getScript()
      Specified by:
      getScript in interface org.gwtproject.i18n.shared.GwtLocale
    • getScriptNotNull

      public java.lang.String getScriptNotNull()
      Specified by:
      getScriptNotNull in interface org.gwtproject.i18n.shared.GwtLocale
    • getVariant

      public java.lang.String getVariant()
      Specified by:
      getVariant in interface org.gwtproject.i18n.shared.GwtLocale
    • getVariantNotNull

      public java.lang.String getVariantNotNull()
      Specified by:
      getVariantNotNull in interface org.gwtproject.i18n.shared.GwtLocale
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • inheritsFrom

      public boolean inheritsFrom​(org.gwtproject.i18n.shared.GwtLocale parent)
      Return true if this locale inherits from the specified locale. Note that locale.inheritsFrom(locale) is false -- if you want that to be true, you should just use locale.getInheritanceChain().contains(x).
      Specified by:
      inheritsFrom in interface org.gwtproject.i18n.shared.GwtLocale
      Parameters:
      parent - locale to test against
      Returns:
      true if parent is an ancestor of this locale
    • isDefault

      public boolean isDefault()
      Specified by:
      isDefault in interface org.gwtproject.i18n.shared.GwtLocale
    • toString

      public java.lang.String toString()
      Specified by:
      toString in interface org.gwtproject.i18n.shared.GwtLocale
      Overrides:
      toString in class java.lang.Object
    • usesSameScript

      public boolean usesSameScript​(org.gwtproject.i18n.shared.GwtLocale other)
      Checks if this locale uses the same script as another locale, taking into account default scripts.
      Specified by:
      usesSameScript in interface org.gwtproject.i18n.shared.GwtLocale
      Parameters:
      other -
      Returns:
      true if the scripts are the same