Package org.cesilko.rachota.core
Class Translator
java.lang.Object
org.cesilko.rachota.core.Translator
Translator class providing localization.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic char
getMnemonic
(String word) Returns mnemonic char found in translated word.static String
getTranslation
(String word) Returns translation of given word in default language.static String
getTranslation
(String word, String[] substitutions) Returns translation of given word in default language and replaces arguments.
-
Constructor Details
-
Translator
public Translator()
-
-
Method Details
-
getTranslation
Returns translation of given word in default language.- Parameters:
word
- Word to be translated.- Returns:
- Translation of given word in default language.
-
getTranslation
Returns translation of given word in default language and replaces arguments.- Parameters:
word
- Word to be translated containing ${0}, ${1} etc. elements.substitutions
- Words that will be used to replace ${0}, ${1} etc. elements.- Returns:
- Translation of given word in default language with substitutions.
-
getMnemonic
Returns mnemonic char found in translated word. As the mnemonic is considered the character after & char. If & is not found in the translation, invisible character is returned.- Parameters:
word
- Word to be translated and where mnemonic char will be searched for.- Returns:
- Mnemonic i.e. character right after first occurence of & character in the translated word.
-