org.mycore.services.i18n
Class MCRTranslation

java.lang.Object
  extended by org.mycore.services.i18n.MCRTranslation

public class MCRTranslation
extends Object

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
MCRTranslation()
           
 
Method Summary
(package private) static String[] getStringArray(String masked)
           
(package private) static boolean isArray(String masked)
           
(package private) static Properties loadProperties()
           
static String translate(String label)
          provides translation for the given label (property key).
static String translate(String label, Object[] arguments)
          provides translation for the given label (property key).
static String translate(String label, String argument)
          provides translation for the given label (property key).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MCRTranslation

public MCRTranslation()
Method Detail

translate

public static String translate(String label)
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 -
Returns:
translated String

translate

public static String translate(String label,
                               Object[] arguments)
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 -
arguments - Objects that are inserted instead of placeholders in the property values
Returns:
translated String

translate

public static String translate(String label,
                               String argument)
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 '\' in argument 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 -
argument - String that is inserted instead of placeholders in the property values
Returns:
translated String
See Also:
translate(String, Object[])

getStringArray

static String[] getStringArray(String masked)

isArray

static boolean isArray(String masked)

loadProperties

static Properties loadProperties()