public interface NLS
Each instance of a NLS manages a set of messages, and each message is defined by a unique ID (int value).
Each language is defined by a locale string. By convention, a locale represents a specific geographical, political, or cultural region. It is often represented using the concatenation of a language code and a country code:
Modifier and Type | Method and Description |
---|---|
String[] |
getAvailableLocales()
Gets the list of available locales.
|
String |
getCurrentLocale()
Gets the current locale.
|
String |
getDisplayName(String locale)
Gets the human-readable name of the given locale.
|
String |
getMessage(int messageID)
Gets the message matching an ID in the current language.
|
String |
getMessage(int messageID,
int count)
Gets the message or one of its plural forms matching an ID and a count value in the current language.
|
String |
getMessage(int messageID,
int count,
String locale)
Gets the message or one of its plural forms matching an ID and a count value in a specific language.
|
String |
getMessage(int messageID,
String locale)
Gets the message matching an ID in a specific language.
|
void |
setCurrentLocale(String locale)
Changes the current locale.
|
String[] getAvailableLocales()
String getCurrentLocale()
String getDisplayName(String locale)
locale
- the locale.String getMessage(int messageID)
messageID
- the ID of the message to retrieve.ArrayIndexOutOfBoundsException
- if the given messageID does not match a valid message.String getMessage(int messageID, int count)
The count argument is intended to be positive, negative values will however still be accepted and plugged into the plural expressions defined in the translations files.
messageID
- the ID of the message to retrieve.count
- the count value.ArrayIndexOutOfBoundsException
- if the given messageID does not match a valid message.String getMessage(int messageID, int count, String locale)
The count argument is intended to be positive, negative values will however still be accepted and plugged into the plural expressions defined in the translations files.
messageID
- the ID of the message to retrieve.count
- the count value.locale
- the locale to use.ArrayIndexOutOfBoundsException
- if the given messageID does not match a valid message.String getMessage(int messageID, String locale)
messageID
- the ID of the message to retrieve.locale
- the locale to use.ArrayIndexOutOfBoundsException
- if the given messageID does not match a valid message.void setCurrentLocale(String locale)
locale
- the locale to set.