org.xwiki.localization
Interface TranslationBundle

All Superinterfaces:
Comparable<TranslationBundle>

@Role
@Unstable
public interface TranslationBundle
extends Comparable<TranslationBundle>

A collection of translations in various Locales.

Since:
4.3M2
Version:
$Id: 73e8c350e380d0cec2da58719e4a4d713dda5898 $

Field Summary
static int DEFAULTPRIORITY
          The default priority of a Bundle.
 
Method Summary
 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 specified Locale.
 
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:
#compareTo(TranslationBundle)

getTranslation

Translation getTranslation(String key,
                           Locale locale)
Return the translation for the given key, in the specified Locale. 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.


Copyright © 2004-2013 XWiki. All Rights Reserved.