Package org.ametys.core.util.language
Class UserLanguagesManager
java.lang.Object
org.ametys.core.util.language.UserLanguagesManager
- All Implemented Interfaces:
Component,Configurable
Handle possible languages for user preferences
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(Configuration configuration) Get the list of possible languagesGet the list of available languages as a JSON objectGet the default language from config parametergetLanguage(String code) Get the language by its codeReturn the JSON representation of a language
-
Field Details
-
ROLE
The component role
-
-
Constructor Details
-
UserLanguagesManager
public UserLanguagesManager()
-
-
Method Details
-
configure
- Specified by:
configurein interfaceConfigurable- Throws:
ConfigurationException
-
getLanguage
Get the language by its code- Parameters:
code- The language code- Returns:
- The language or
nullif not found
-
getAvailableLanguages
Get the list of possible languages- Returns:
- the association language-code Language object
-
getAvailableLanguagesAsJsonObject
Get the list of available languages as a JSON object- Returns:
- The available languages
-
getDefaultLanguage
Get the default language from config parameter- Returns:
- The default language
-
toJson
Return the JSON representation of a language- Parameters:
language- The language- Returns:
- The json object representing the language
-