Package play.i18n
Class Lang
- java.lang.Object
-
- play.i18n.Lang
-
public class Lang extends java.lang.ObjectLanguage support
-
-
Constructor Summary
Constructors Constructor Description Lang()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidchange(java.lang.String locale)Change language for next requestsstatic voidclear()Clears the current language - This wil trigger resolving language from request if not manually set.static java.lang.Stringget()Retrieve the current language or nullstatic java.util.LocalegetLocale()static java.util.LocalegetLocale(java.lang.String localeStr)static java.util.LocalegetLocaleOrDefault(java.lang.String localeStr)static booleanset(java.lang.String locale)Force the current languagestatic voidsetDefaultLocale()
-
-
-
Method Detail
-
get
public static java.lang.String get()
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
public static void change(java.lang.String locale)
Change language for next requests- Parameters:
locale- (e.g. "fr", "ja", "it", "en_ca", "fr_be", ...)
-
setDefaultLocale
public static void setDefaultLocale()
-
getLocale
public static java.util.Locale getLocale()
- 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)
-
-