Package org.ametys.core.util.language
Class LocaleHelper
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.core.util.language.LocaleHelper
- All Implemented Interfaces:
DeferredServiceable,Component,LogEnabled
Retrieve the language to use in interface from the current user preferences, the configuration parameters or the browser.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CurrentUserProviderThe current user providerprotected UserLanguagesManagerThe current user providerprotected UserManagerThe current user providerstatic final StringThe component role -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeferredService(ServiceManager manager) Pass theServiceManagerused to access other components.protected LocaleRetrieve the locale from the current userfindLocale(Map objectModel) Find the locale to use in interface.Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
ROLE
The component role -
_currentUserProvider
The current user provider -
_userManager
The current user provider -
_userLanguagesManager
The current user provider
-
-
Constructor Details
-
LocaleHelper
public LocaleHelper()
-
-
Method Details
-
deferredService
Description copied from interface:DeferredServiceablePass theServiceManagerused to access other components.- Specified by:
deferredServicein interfaceDeferredServiceable- Parameters:
manager- TheServiceManagerwhich thisDeferredServiceableuses. Must not benull.- Throws:
ServiceException- if an error occurs
-
findLocale
Find the locale to use in interface.- Parameters:
objectModel- The object model to retrieve the default locale from browser if not found in user preferences or configuration parameters- Returns:
- The locale to use, first try from user preferences, then from request, then from configuration parameters and then from I18nUtils.findLocale (server locale), null if no locale was found
-
findCurrentUserLocale
Retrieve the locale from the current user- Returns:
- The locale from the current user or none if no user found or no language found for the user
-