Package org.mycore.services.i18n
Class MCRTranslation
java.lang.Object
org.mycore.services.i18n.MCRTranslation
provides services for internationalization in mycore application. You have to provide a property file named
messages.properties in your classpath for this class to work.
- Author:
- Radi Radichev, Thomas Scheffler (yagee)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Checks whether there is a value for the given label and current locale.static Document
static Locale
static Locale
static ResourceBundle
getResourceBundle
(String baseName, Locale locale) static String
provides translation for the given label (property key).static String
provides translation for the given label (property key).static String
provides translation for the given label (property key).static String
provides translation for the given label (property key).static String
provides translation for the given label (property key).translatePrefix
(String prefix) Returns a map of label/value pairs which match with the given prefix.translatePrefix
(String prefix, Locale locale) Returns a map of label/value pairs which match with the given prefix.static String
translateWithBaseName
(String label, String baseName) provides translation for the given label (property key).
-
Constructor Details
-
MCRTranslation
public MCRTranslation()
-
-
Method Details
-
translate
provides translation for the given label (property key). The current locale that is needed for translation is gathered by the language of the current MCRSession.- Parameters:
label
- property key- Returns:
- translated String
-
exists
Checks whether there is a value for the given label and current locale.- Parameters:
label
- property key- Returns:
true
if there is a value,false
otherwise
-
translateWithBaseName
provides translation for the given label (property key). The current locale that is needed for translation is gathered by the language of the current MCRSession.- Parameters:
label
- property keybaseName
- a fully qualified class name- Returns:
- translated String
-
translate
provides translation for the given label (property key).- Parameters:
label
- property keylocale
- target locale of translation- Returns:
- translated String
-
translate
provides translation for the given label (property key).- Parameters:
label
- property keylocale
- target locale of translationbaseName
- a fully qualified class name- Returns:
- translated String
-
translatePrefix
Returns a map of label/value pairs which match with the given prefix. The current locale that is needed for translation is gathered by the language of the current MCRSession.- Parameters:
prefix
- label starts with- Returns:
- map of labels with translated values
-
translatePrefix
Returns a map of label/value pairs which match with the given prefix.- Parameters:
prefix
- label starts withlocale
- target locale of translation- Returns:
- map of labels with translated values
-
translate
provides translation for the given label (property key). The current locale that is needed for translation is gathered by the language of the current MCRSession.- Parameters:
label
- property keyarguments
- Objects that are inserted instead of placeholders in the property values- Returns:
- translated String
-
translate
provides translation for the given label (property key). The current locale that is needed for translation is gathered by the language of the current MCRSession. Be aware that any occurence of ';' and '\' inargument
has to be masked by '\'. You can use ';' to build an array of arguments: "foo;bar" would result in {"foo","bar"} (the array)- Parameters:
label
- property keyargument
- String that is inserted instead of placeholders in the property values- Returns:
- translated String
- See Also:
-
getCurrentLocale
-
getLocale
-
getAvailableLanguages
-
getAvailableLanguagesAsXML
-
getResourceBundle
-