Class Localization


  • public class Localization
    extends Object

    Class for handling localization for the clients.

    Since:
    0.0.1
    • Constructor Detail

      • Localization

        public Localization​(Locale locale)

        Overloaded constructor.

        Parameters:
        locale - the Locale for this localization instance
    • Method Detail

      • getLocale

        public Locale getLocale()

        Getter for the Locale of this localization instance.

        Returns:
        the Locale for this localization instance.
      • setLocale

        public void setLocale​(Locale locale)

        Setter for the Locale for this localization instance.

        Parameters:
        locale - the Locale
      • getString

        public String getString​(String key)

        Returns the translation for the specified key. If it can't find the key in the current specified language's localization file, it attempts to use the fallback Locale's localization file as the translation source.

        Parameters:
        key - the key to get the translation for
        Returns:
        the translated string
      • getString

        public String getString​(String key,
                                Object... variables)

        Returns a formatted translation for the specified key.

        Parameters:
        key - the key to get the translation for
        variables - the variables which shall be inserted into the translation
        Returns:
        the translated string