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 Locale
getLocale()
Getter for theLocale
of this localization instance.String
getString(String key)
Returns the translation for the specified key.String
getString(String key, Object... variables)
Returns a formatted translation for the specified key.void
setLocale(Locale locale)
Setter for theLocale
for this localization instance.
-
-
-
Constructor Detail
-
Localization
public Localization(Locale locale)
Overloaded constructor.
- Parameters:
locale
- theLocale
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
- 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
-
-