Package org.xwiki.localization
Interface TranslationBundle
-
- All Superinterfaces:
Comparable<TranslationBundle>
@Role public interface TranslationBundle extends Comparable<TranslationBundle>
A collection of translations in various Locales.- Since:
- 4.3M2
- Version:
- $Id: d0c47a321c2961b0548a5f9b778b4e55babc926b $
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULTPRIORITY
The default priority of a Bundle.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
getId()
int
getPriority()
When searching for a translation, the bundles are searched in order until one of these bundles contains a value for the searched key.Translation
getTranslation(String key, Locale locale)
Return the translation for the given key, in the specifiedLocale
.-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Field Detail
-
DEFAULTPRIORITY
static final int DEFAULTPRIORITY
The default priority of a Bundle.- See Also:
- Constant Field Values
-
-
Method Detail
-
getId
String getId()
- Returns:
- the unique identifier of the bundle
-
getPriority
int getPriority()
When searching for a translation, the bundles are searched in order until one of these bundles contains a value for the searched key. The bundle priority defines this order. Lower is better, meaning that a bundle with a smaller priority value will be searched before a bundle with a higher value.- Returns:
- the priority
- See Also:
Comparable.compareTo(Object)
-
getTranslation
Translation getTranslation(String key, Locale locale)
Return the translation for the given key, in the specifiedLocale
. If not translation for the exact Locale can be found it fallback on the language and then on the default translation if any.- Parameters:
key
- the key to translate.locale
- the locale to translate into.- Returns:
- the
Translation
or null if none can be found.
-
-