Class Translator


  • public class Translator
    extends java.lang.Object
    Translator class providing localization.
    • Constructor Summary

      Constructors 
      Constructor Description
      Translator()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static char getMnemonic​(java.lang.String word)
      Returns mnemonic char found in translated word.
      static java.lang.String getTranslation​(java.lang.String word)
      Returns translation of given word in default language.
      static java.lang.String getTranslation​(java.lang.String word, java.lang.String[] substitutions)
      Returns translation of given word in default language and replaces arguments.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Translator

        public Translator()
    • Method Detail

      • getTranslation

        public static java.lang.String getTranslation​(java.lang.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 java.lang.String getTranslation​(java.lang.String word,
                                                      java.lang.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​(java.lang.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.