Class Language


  • public class Language
    extends java.lang.Object
    Implements a wrapper around a locale that supports different codes for country and language. This is mostly used as workaround for language trees that don't follow the same format for locales in java.util.Locale.
    • Constructor Summary

      Constructors 
      Constructor Description
      Language​(java.lang.String code)  
      Language​(java.lang.String language, java.lang.String country)  
      Language​(java.util.Locale locale)  
      Language​(java.util.Locale locale, java.lang.String language, java.lang.String country)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getCountryCode()  
      java.lang.String getLanguageCode()  
      java.util.Locale getLocale()  
      static java.util.Locale getLocale​(java.lang.String code)
      Parses a language code such as "de", "de_CH", "de_DE_EURO" or "de-CH" and returns the proper Locale object.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Language

        public Language​(java.util.Locale locale)
      • Language

        public Language​(java.lang.String code)
      • Language

        public Language​(java.util.Locale locale,
                        java.lang.String language,
                        java.lang.String country)
      • Language

        public Language​(java.lang.String language,
                        java.lang.String country)
    • Method Detail

      • getLocale

        public java.util.Locale getLocale()
      • getLanguageCode

        public java.lang.String getLanguageCode()
      • getCountryCode

        public java.lang.String getCountryCode()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getLocale

        public static java.util.Locale getLocale​(java.lang.String code)
        Parses a language code such as "de", "de_CH", "de_DE_EURO" or "de-CH" and returns the proper Locale object.
        Parameters:
        code - language code
        Returns:
        locale object