public abstract class TranslationService extends Object
Constructor and Description |
---|
TranslationService()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static String |
currentLocale() |
String |
format(String key,
Object... args)
Look up a message in the i18n resource message bundle by key, then format the message with the
given arguments and return the result.
|
String |
getActiveLocale() |
static String |
getBrowserLocale()
Gets the browser's configured locale.
|
Collection<String> |
getSupportedLocales() |
String |
getTranslation(String translationKey)
Gets the translation for the given i18n translation key.
|
boolean |
isEnabled() |
protected void |
registerBundle(String jsonData,
String locale)
Registers the bundle with the translation service.
|
protected void |
registerJSON(JSONMap data,
String locale)
Registers some i18n data with the translation service.
|
protected void |
registerTranslation(String key,
String value,
String locale)
Registers a single translation.
|
static void |
retranslateTemplatedBeans()
Re-translate displayed
Templated beans to the current locale. |
static void |
setCurrentLocale(String locale)
Forcibly set the current locale and re-translate all instantiated
Templated beans. |
static void |
setCurrentLocaleWithoutUpdate(String locale)
Forcibly set the current locale but do not re-translate existing templated instances.
|
public boolean isEnabled()
public Collection<String> getSupportedLocales()
protected void registerBundle(String jsonData, String locale)
jsonData
- protected void registerTranslation(String key, String value, String locale)
key
- value
- locale
- protected void registerJSON(JSONMap data, String locale)
data
- locale
- public String getTranslation(String translationKey)
translationKey
- public String format(String key, Object... args)
key
- args
- public String getActiveLocale()
public static String currentLocale()
public static final String getBrowserLocale()
public static final void setCurrentLocale(String locale)
Templated
beans.locale
- public static final void setCurrentLocaleWithoutUpdate(String locale)
locale
- public static void retranslateTemplatedBeans()
Templated
beans to the current locale.Copyright © 2013-2015 JBoss, a division of Red Hat. All Rights Reserved.