Class TranslationHandlerImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseNetworkedHandlerImpl
-
- org.cyclos.impl.contentmanagement.TranslationHandlerImpl
-
- All Implemented Interfaces:
ApplicationUpgradeInitializationListener,BaseApplicationInitializationListener,TranslationHandler,MessageProducer
@Component public class TranslationHandlerImpl extends BaseNetworkedHandlerImpl implements TranslationHandler, ApplicationUpgradeInitializationListener
Provides access to translation messages
-
-
Field Summary
-
Fields inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
authHandler, conversionHandler, customFieldValueHandler, entityManagerHandler, groupsHandler, productsHandler, restBeanPropertyMapping, userLocatorHandler
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, configurationHandler, dataTranslationHandler, notificationHandler, profileFieldHandler, transactionHandler, translationHandler
-
Fields inherited from interface org.cyclos.impl.BaseApplicationInitializationListener
MAX_PRIORITY, MIN_PRIORITY, NORMAL_PRIORITY
-
Fields inherited from interface org.cyclos.impl.contentmanagement.TranslationHandler
UNKNOWN_CUSTOM_TRANSLATION_SOURCE_VALUE
-
-
Constructor Summary
Constructors Constructor Description TranslationHandlerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResourceBundlegetBuiltinResourceBundle(BuiltinLanguage language, Module module)Returns the built-in resource bundle for the given language and module.Map<String,CustomizedTranslation>getCustomizedKeys(long languageId)Returns the customized keys for the given language's idCyclosResourceBundlegetOriginalEnglishResourceBundle()Returns theCyclosResourceBundlewith the original English keysCyclosResourceBundlegetResourceBundle()Returns theCyclosResourceBundlefor the current userCyclosResourceBundlegetResourceBundle(Language language)Returns theCyclosResourceBundlefor the given languagevoidinitialize()Stringmessage(Language language, MessageKey key, Object... arguments)Returns a translation message for the given language, applying the given arguments, if anyStringmessage(MessageFormat messageFormat, Language language, MessageKey key, Object... arguments)Returns a translation message for the given language, applying the given arguments, if any and formatting the message according to the given message formatStringmessage(MessageFormat messageFormat, MessageKey key, Object... arguments)Returns a translation message for the given message key and arguments, formatting it according to the given message formatStringmessage(MessageKey key, Object... arguments)Returns a translation message for the given message key and argumentsvoidonApplicationUpgradeInitialization()Invoked when the application service is initialized-
Methods inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
canManage, checkManagesUser, checkPermission, checkRelatesToUser, checkValue, clearAlreadyValidated, getBaseEntityManagerHandler, getConfiguration, getLoggedBasicUser, getLoggedUser, getProducts, getTranslatedName, getTranslatedValue, hasPermission, hasValue, inSameNetwork, inSameNetworkOrGlobal, isAdmin, isAlreadyValidated, isBroker, isGlobalAdmin, isGlobalAdminInNetwork, isGuest, isLoggedIn, isMember, isMemberOnly, isNetworkAdmin, isOperator, isRelatedToUser, isSystem, isUserManager, isUserManagerOf, permission, permission, permissionOptionalValue, permissionOptionalValue, setAlreadyValidated, toDate, toDateTime, validate
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, dataTranslationProxy, delete, detach, doDataTranslationProxy, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.cyclos.impl.BaseApplicationInitializationListener
applicationInitializationPriority, getInitializationId
-
-
-
-
Method Detail
-
getBuiltinResourceBundle
public ResourceBundle getBuiltinResourceBundle(BuiltinLanguage language, Module module)
Returns the built-in resource bundle for the given language and module. Having a separated cache is important when there are multiple languages sharing the same template. This will avoid multiple copies of the immutable bundles for each module.- Specified by:
getBuiltinResourceBundlein interfaceTranslationHandler
-
getCustomizedKeys
public Map<String,CustomizedTranslation> getCustomizedKeys(long languageId)
Description copied from interface:TranslationHandlerReturns the customized keys for the given language's id- Specified by:
getCustomizedKeysin interfaceTranslationHandler
-
getOriginalEnglishResourceBundle
public CyclosResourceBundle getOriginalEnglishResourceBundle()
Description copied from interface:TranslationHandlerReturns theCyclosResourceBundlewith the original English keys- Specified by:
getOriginalEnglishResourceBundlein interfaceTranslationHandler
-
getResourceBundle
public CyclosResourceBundle getResourceBundle()
Description copied from interface:TranslationHandlerReturns theCyclosResourceBundlefor the current user- Specified by:
getResourceBundlein interfaceTranslationHandler
-
getResourceBundle
public CyclosResourceBundle getResourceBundle(Language language)
Description copied from interface:TranslationHandlerReturns theCyclosResourceBundlefor the given language- Specified by:
getResourceBundlein interfaceTranslationHandler
-
initialize
@PostConstruct public void initialize()
-
message
public String message(Language language, MessageKey key, Object... arguments)
Description copied from interface:TranslationHandlerReturns a translation message for the given language, applying the given arguments, if any- Specified by:
messagein interfaceTranslationHandler- Overrides:
messagein classAbstractServerComponent
-
message
public String message(MessageFormat messageFormat, Language language, MessageKey key, Object... arguments)
Description copied from interface:TranslationHandlerReturns a translation message for the given language, applying the given arguments, if any and formatting the message according to the given message format- Specified by:
messagein interfaceTranslationHandler- Overrides:
messagein classAbstractServerComponent
-
message
public String message(MessageFormat messageFormat, MessageKey key, Object... arguments)
Description copied from interface:MessageProducerReturns a translation message for the given message key and arguments, formatting it according to the given message format- Specified by:
messagein interfaceMessageProducer- Overrides:
messagein classAbstractNetworkedServerComponent
-
message
public String message(MessageKey key, Object... arguments)
Description copied from interface:MessageProducerReturns a translation message for the given message key and arguments- Specified by:
messagein interfaceMessageProducer- Overrides:
messagein classAbstractNetworkedServerComponent
-
onApplicationUpgradeInitialization
public void onApplicationUpgradeInitialization()
Description copied from interface:ApplicationUpgradeInitializationListenerInvoked when the application service is initialized- Specified by:
onApplicationUpgradeInitializationin interfaceApplicationUpgradeInitializationListener
-
-