Package play.i18n

Class Lang


  • public class Lang
    extends java.lang.Object
    Language support
    • Constructor Summary

      Constructors 
      Constructor Description
      Lang()  
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static void change​(java.lang.String locale)
      Deprecated.
      static void change​(java.lang.String locale, Http.Response response)
      Change language for next requests
      static void clear()
      Clears the current language - This wil trigger resolving language from request if not manually set.
      static java.lang.String get()
      Deprecated.
      This method depends on current HTTP request, and thus can be used only from web controllers.
      static java.lang.String get​(Http.Request currentRequest, Http.Response currentResponse)  
      static java.util.Locale getLocale()
      Deprecated.
      static java.util.Locale getLocale​(java.lang.String localeStr)  
      static java.util.Locale getLocale​(Http.Request currentRequest, Http.Response currentResponse)  
      static java.util.Locale getLocaleOrDefault​(java.lang.String localeStr)  
      static boolean set​(java.lang.String locale)
      Force the current language
      static void setDefaultLocale()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Lang

        public Lang()
    • Method Detail

      • get

        @Deprecated
        public static java.lang.String get()
        Deprecated.
        This method depends on current HTTP request, and thus can be used only from web controllers.
        Retrieve the current language or null
        Returns:
        The current language (fr, ja, it ...) or null
      • set

        public static boolean set​(java.lang.String locale)
        Force the current language
        Parameters:
        locale - (fr, ja, it ...)
        Returns:
        false if the language is not supported by the application
      • clear

        public static void clear()
        Clears the current language - This wil trigger resolving language from request if not manually set.
      • change

        @Deprecated
        public static void change​(java.lang.String locale)
        Deprecated.
      • change

        public static void change​(java.lang.String locale,
                                  Http.Response response)
        Change language for next requests
        Parameters:
        locale - (e.g. "fr", "ja", "it", "en_ca", "fr_be", ...)
        response - current http response
      • setDefaultLocale

        public static void setDefaultLocale()
      • getLocale

        @Deprecated
        public static java.util.Locale getLocale()
        Deprecated.
      • getLocale

        public static java.util.Locale getLocale​(Http.Request currentRequest,
                                                 Http.Response currentResponse)
        Returns:
        the default locale if the Locale cannot be found otherwise the locale associated to the current Lang.
      • getLocaleOrDefault

        public static java.util.Locale getLocaleOrDefault​(java.lang.String localeStr)
      • getLocale

        public static java.util.Locale getLocale​(java.lang.String localeStr)