Package com.suncode.pwfl.translation
Interface Translator
- All Known Subinterfaces:
ClassLoaderTranslator
,PackageTranslator
- All Known Implementing Classes:
AbstractTranslator
,EmptyTranslator
,PropertiesTranslator
Translator is the standard way of translating key-base messages for given Locale.
Every registered in TranslatorRegistry
translator is identified by unique (per scope)
name.
- Author:
- Cezary Kozar 11 sie 2015
-
Method Summary
Modifier and TypeMethodDescriptiongetLocalizedString
(String key) Creates LocalizedString with given key.getLocalizedString
(String key, Object... args) Creates LocalizedString with given key and message arguments.getLocalizedString
(String key, String defaultValue) Creates LocalizedString with given key and default value.getLocalizedString
(String key, String[] fallbackKeys, String defaultValue) Creates LocalizedString with given key, fallback keys and default value.getLocalizedString
(String key, String[] fallbackKeys, String defaultValue, Locale locale, Object... args) Creates LocalizedString.getLocalizedString
(String key, String defaultValue, Object... args) Creates LocalizedString with given key, default value and message arguments.getLocalizedString
(String key, String defaultValue, Locale locale) Creates LocalizedString with given key, locale and default value.getLocalizedString
(String key, String defaultValue, Locale locale, Object... args) Creates LocalizedString with given key, default value, locale and message arguments.getLocalizedString
(String key, Locale locale) Creates LocalizedString with given key and locale.getLocalizedString
(String key, Locale locale, Object... args) Creates LocalizedString with given key, locale and message arguments.getMessage
(String key) Return translated message for given key using current user locale.getMessage
(String key, Object... args) Return translated message for given key and arguments using current user locale.getMessage
(String key, Locale locale) Return translated message for given key and locale.getMessage
(String key, Locale locale, Object... args) Return translated message for given key, locale and arguments.getMessages
(Locale locale) Returns key-value map with every available translations for given locale.
-
Method Details
-
getMessages
Returns key-value map with every available translations for given locale. -
getMessage
Return translated message for given key using current user locale.- Throws:
NoTranslationException
- See Also:
-
getMessage
Return translated message for given key and locale.- Throws:
NoTranslationException
- See Also:
-
getMessage
Return translated message for given key and arguments using current user locale.- Throws:
NoTranslationException
- See Also:
-
getMessage
Return translated message for given key, locale and arguments.- Parameters:
key
- message keylocale
- localeargs
- optional placeholder arguments (e.g. {0} {1})- Returns:
- translated message for given key
- Throws:
NoTranslationException
-
getLocalizedString
Creates LocalizedString with given key. -
getLocalizedString
Creates LocalizedString with given key and default value. -
getLocalizedString
Creates LocalizedString with given key, fallback keys and default value. -
getLocalizedString
Creates LocalizedString with given key and locale. -
getLocalizedString
Creates LocalizedString with given key, locale and default value. -
getLocalizedString
Creates LocalizedString with given key and message arguments. -
getLocalizedString
Creates LocalizedString with given key, default value and message arguments. -
getLocalizedString
Creates LocalizedString with given key, locale and message arguments. -
getLocalizedString
Creates LocalizedString with given key, default value, locale and message arguments. -
getLocalizedString
LocalizedString getLocalizedString(String key, String[] fallbackKeys, String defaultValue, Locale locale, Object... args) Creates LocalizedString.- Parameters:
key
- message keyfallbackKeys
- fallback keysdefaultValue
- default value returned when no translation could be foundlocale
- localeargs
- optional message arguments (e.g. {0} {1})- Returns:
- LocalizedString
- See Also:
-