Class Translator

java.lang.Object
org.cesilko.rachota.core.Translator

public class Translator extends Object
Translator class providing localization.
  • Constructor Details

    • Translator

      public Translator()
  • Method Details

    • getTranslation

      public static String getTranslation(String word)
      Returns translation of given word in default language.
      Parameters:
      word - Word to be translated.
      Returns:
      Translation of given word in default language.
    • getTranslation

      public static String getTranslation(String word, String[] substitutions)
      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

      public static char getMnemonic(String word)
      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.