Class CyclosResourceBundle
- java.lang.Object
-
- java.util.ResourceBundle
-
- org.cyclos.impl.contentmanagement.CyclosResourceBundle
-
public class CyclosResourceBundle extends ResourceBundle
AResourceBundlewhich is actually a wrapper for other resource bundles, one per module. It also allows setting customized keys, which have precedence over the built-in keys. The full keys are composed byMODULE.SUBMODULE.key. TheMODULEpart is used to lookup an internal resource bundle, and theSUBMODULE.keyis what is actually expected to be on the translation files.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.ResourceBundle
ResourceBundle.Control
-
-
Constructor Summary
Constructors Constructor Description CyclosResourceBundle(CyclosResourceBundle parent, long languageId, BuiltinLanguage template, TranslationHandler translationHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddResourceBundle(Module mod, ResourceBundle rb)Registers the internalResourceBundlefor the given moduleprotected StringdoGetString(String key, boolean allowInvalid)Stringget(MessageKey key)Returns a translation byMessageKeyMap<String,String>getBySubmodule(Set<Submodule> submodules, boolean onlyCustomized)Returns all keys / values in the given submodulesMap<String,CustomizedTranslation>getCustomizedKeys()Returns all customized keys with their valuesCustomizedTranslationgetCustomizedTranslation(String key)StringgetEvenIfInvalid(String key)Return a custom translation even if it's invalid.Map<String,String>getI18n()Returns new frontend keys, including the customized onesEnumeration<String>getKeys()longgetLanguageId()StringgetOriginal(MessageKey key)Returns the original value for the given keyStringgetOriginalValue(String key)Returns the original value for the given keyCyclosResourceBundlegetParent()BuiltinLanguagegetTemplate()protected ObjecthandleGetObject(String key)Stringmessage(String key, MessageFormat messageFormat, Object... arguments)Resolves a translation messagePage<TranslationKeyVO>search(TranslationQuery params)-
Methods inherited from class java.util.ResourceBundle
clearCache, clearCache, containsKey, getBaseBundleName, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, handleKeySet, keySet, setParent
-
-
-
-
Constructor Detail
-
CyclosResourceBundle
public CyclosResourceBundle(CyclosResourceBundle parent, long languageId, BuiltinLanguage template, TranslationHandler translationHandler)
-
-
Method Detail
-
addResourceBundle
public void addResourceBundle(Module mod, ResourceBundle rb)
Registers the internalResourceBundlefor the given module
-
get
public String get(MessageKey key)
Returns a translation byMessageKey
-
getBySubmodule
public Map<String,String> getBySubmodule(Set<Submodule> submodules, boolean onlyCustomized)
Returns all keys / values in the given submodules
-
getCustomizedKeys
public Map<String,CustomizedTranslation> getCustomizedKeys()
Returns all customized keys with their values
-
getCustomizedTranslation
public CustomizedTranslation getCustomizedTranslation(String key)
-
getEvenIfInvalid
public String getEvenIfInvalid(String key)
Return a custom translation even if it's invalid.
-
getI18n
public Map<String,String> getI18n()
Returns new frontend keys, including the customized ones
-
getKeys
public Enumeration<String> getKeys()
- Specified by:
getKeysin classResourceBundle
-
getLanguageId
public long getLanguageId()
-
getOriginal
public String getOriginal(MessageKey key)
Returns the original value for the given key
-
getOriginalValue
public String getOriginalValue(String key)
Returns the original value for the given key
-
getParent
public CyclosResourceBundle getParent()
-
getTemplate
public BuiltinLanguage getTemplate()
-
message
public String message(String key, MessageFormat messageFormat, Object... arguments)
Resolves a translation message
-
search
public Page<TranslationKeyVO> search(TranslationQuery params)
-
handleGetObject
protected Object handleGetObject(String key)
- Specified by:
handleGetObjectin classResourceBundle
-
-