public class Localization extends Object
Class for handling localization for the clients.
Constructor and Description |
---|
Localization(Locale locale)
Overloaded constructor.
|
Modifier and Type | Method and Description |
---|---|
Locale |
getLocale()
Getter for the
Locale 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 the
Locale for this localization instance. |
public Localization(Locale locale)
Overloaded constructor.
locale
- the Locale
for this localization instancepublic Locale getLocale()
Getter for the Locale
of this localization instance.
Locale
for this localization instance.public void setLocale(Locale locale)
Setter for the Locale
for this localization instance.
locale
- the Locale
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.
key
- the key to get the translation forCopyright © 2016. All rights reserved.