public class DefaultI18N extends java.lang.Object implements I18N
Loading of these UI resources is done as follows:
- On initialization of the DefaultI18N:
- Resource files for the default language are loaded
- If a different language is requested, the content will be loaded on demand (and stored in memory for future use)
Note that if a specified language does not have the specified key, the result from the defaultfallback language (English)
will be used instead.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_I8N_RESOURCES_DIR |
static java.lang.String |
DEFAULT_LANGUAGE |
static java.lang.String |
FALLBACK_LANGUAGE |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDefaultLanguage()
Get the currently set default language as an ISO 639-1 code
|
static I18N |
getInstance() |
java.lang.String |
getMessage(java.lang.String key)
Get the specified message in the default language (according to
I18N.getDefaultLanguage() |
java.lang.String |
getMessage(java.lang.String langCode,
java.lang.String key)
Get the specified message for the specified language
|
void |
setDefaultLanguage(java.lang.String langCode)
Set the default language
|
public static final java.lang.String DEFAULT_LANGUAGE
public static final java.lang.String FALLBACK_LANGUAGE
public static final java.lang.String DEFAULT_I8N_RESOURCES_DIR
public static I18N getInstance()
public java.lang.String getMessage(java.lang.String key)
I18N
I18N.getDefaultLanguage()
getMessage
in interface I18N
key
- Key valuepublic java.lang.String getMessage(java.lang.String langCode, java.lang.String key)
I18N
getMessage
in interface I18N
langCode
- ISO 639-1 language code: "en", "ja", etckey
- Key value for the message to retrievepublic java.lang.String getDefaultLanguage()
I18N
getDefaultLanguage
in interface I18N
public void setDefaultLanguage(java.lang.String langCode)
I18N
setDefaultLanguage
in interface I18N
langCode
- Language code, as an ISO 639-1 code