Package play.i18n
Class Lang
java.lang.Object
play.api.i18n.Lang
play.i18n.Lang
- All Implemented Interfaces:
Serializable,scala.Equals,scala.Product
public class Lang
extends play.api.i18n.Lang
A Lang supported by the application.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionavailables(Application app) Retrieve Lang availables from the application configuration.code()The language tag (such as fr or en-US).country()A valid ISO Country Code.static LangThe default Lang (platform default).static LangCreate a Lang value from a code (such as fr or en-US).language()A valid ISO Language Code.static Langpreferred(Application app, List<Lang> availableLangs) Guess the preferred lang in the langs set passed as argument.script()The script tag for this LangtoLocale()Convert to a Java Locale value.variant()The variant tag for this LangMethods inherited from class play.api.i18n.Lang
apply, apply, apply, apply$default$2, apply$default$3, apply$default$4, asJava, canEqual, copy, copy$default$1, equals, get, hashCode, jsonOReads, jsonOWrites, jsonTagReads, jsonTagWrites, locale, logger, productArity, productElement, productElementName, productElementNames, productIterator, productPrefix, satisfies, toString, unapply
-
Constructor Details
-
Lang
public Lang(play.api.i18n.Lang underlyingLang) -
Lang
-
-
Method Details
-
language
A valid ISO Language Code.- Overrides:
languagein classplay.api.i18n.Lang
-
country
A valid ISO Country Code.- Overrides:
countryin classplay.api.i18n.Lang
-
script
The script tag for this Lang- Overrides:
scriptin classplay.api.i18n.Lang
-
variant
The variant tag for this Lang- Overrides:
variantin classplay.api.i18n.Lang
-
code
The language tag (such as fr or en-US).- Overrides:
codein classplay.api.i18n.Lang
-
toLocale
Convert to a Java Locale value.- Overrides:
toLocalein classplay.api.i18n.Lang
-
forCode
Create a Lang value from a code (such as fr or en-US).- Parameters:
code- the language code- Returns:
- the Lang for the code, or null of no matching lang was found.
-
availables
Retrieve Lang availables from the application configuration.- Parameters:
app- the current application.- Returns:
- the list of available Lang.
-
preferred
Guess the preferred lang in the langs set passed as argument. The first Lang that matches an available Lang wins, otherwise returns the first Lang available in this application.- Parameters:
app- the current applicationavailableLangs- the set of langs from which to guess the preferred- Returns:
- the preferred lang.
-
defaultLang
The default Lang (platform default).
-