Class Localization
- java.lang.Object
-
- com.github.dannil.scbjavaclient.utility.Localization
-
public class Localization extends Object
Class for handling localization for the clients.
- Since:
- 0.0.1
-
-
Constructor Summary
Constructors Constructor Description Localization(Locale locale)Overloaded constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LocalegetLocale()Getter for theLocaleof this localization instance.StringgetString(String key)Returns the translation for the specified key.StringgetString(String key, Object... variables)Returns a formatted translation for the specified key.voidsetLocale(Locale locale)Setter for theLocalefor this localization instance.
-
-
-
Constructor Detail
-
Localization
public Localization(Locale locale)
Overloaded constructor.
- Parameters:
locale- theLocalefor this localization instance
-
-
Method Detail
-
getLocale
public Locale getLocale()
Getter for the
Localeof this localization instance.- Returns:
- the
Localefor this localization instance.
-
setLocale
public void setLocale(Locale locale)
Setter for the
Localefor this localization instance.- Parameters:
locale- theLocale
-
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
-
-