public class DefaultI18N extends 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 String |
DEFAULT_LANGUAGE |
static String |
FALLBACK_LANGUAGE |
| Modifier and Type | Method and Description |
|---|---|
String |
getDefaultLanguage()
Get the currently set default language as an ISO 639-1 code
|
static I18N |
getInstance()
Get global instance (used in single-session mode)
|
static I18N |
getInstance(String sessionId)
Get instance for session (used in multi-session mode)
|
String |
getMessage(String key)
Get the specified message in the default language (according to
I18N.getDefaultLanguage() |
String |
getMessage(String langCode,
String key)
Get the specified message for the specified language
|
Map<String,String> |
getMessages(String langCode)
Get all internationalization messages for the specified language code
|
static I18N |
removeInstance(String sessionId)
Remove I18N instance for session
|
void |
setDefaultLanguage(String langCode)
Set the default language
|
public static final String DEFAULT_LANGUAGE
public static final String FALLBACK_LANGUAGE
public static I18N getInstance()
public static I18N getInstance(String sessionId)
sessionId - sessionpublic static I18N removeInstance(String sessionId)
sessionId - session IDsessionId,
or null if there was no mapping for sessionIdpublic String getMessage(String key)
I18NI18N.getDefaultLanguage()getMessage in interface I18Nkey - Key valuepublic String getMessage(String langCode, String key)
I18NgetMessage in interface I18NlangCode - ISO 639-1 language code: "en", "ja", etckey - Key value for the message to retrievepublic String getDefaultLanguage()
I18NgetDefaultLanguage in interface I18Npublic void setDefaultLanguage(String langCode)
I18NsetDefaultLanguage in interface I18NlangCode - Language code, as an ISO 639-1 codeCopyright © 2019. All rights reserved.