Interface TranslationPackage
- All Known Subinterfaces:
MutableTranslationPackage
- All Known Implementing Classes:
BasicTranslationPackage,ClientLocalizationManager,ClientLocalizationManagerImpl,DelegateTranslationPackage,DesignerLocalizationManager,TranslationPackageDiff
public interface TranslationPackage
A translation package holds the keys and one or more translations for the keys.
-
Method Summary
Modifier and TypeMethodDescriptionCreates an empty, modifiable diff that respects the same rules as this translation package.Translates the given key into the requested locale.The key hash rule dictates how term equivalency is calculated.Translates the given key into the requested locale, returning null if no translation exists.getTranslationsFor(String key) booleanReturns whether the key is defined in the package.booleanReturns whether there is a translation defined for the given key in the given locale.
-
Method Details
-
getBaseLocale
Locale getBaseLocale()- Returns:
- the "base" locale, the language in which the terms are defined.
-
getKeyHashRule
KeyHashRule getKeyHashRule()The key hash rule dictates how term equivalency is calculated. Though this field should not be used to look up terms, it's important that derived translation packages use the same rule. -
getAvailableLocales
Collection<Locale> getAvailableLocales()- Returns:
- the locales for which translations are available. This will include the base locale.
-
isDefined
Returns whether the key is defined in the package. A key can be defined without any particular translations. -
isDefined
Returns whether there is a translation defined for the given key in the given locale. -
get
Translates the given key into the requested locale.- Parameters:
locale- the locale to find a match forkey- the key to find a match for- Returns:
- the translation of the key for the requested locale, or the key itself if no translation is available.
-
getStrict
Translates the given key into the requested locale, returning null if no translation exists.- Parameters:
locale- the locale to find a value forkey- the key to find a match for- Returns:
- the translation, or null if the translation doesn't exist.
-
getTranslationsFor
- Returns:
- a map of all of the translations available for a given key.
-
getAvailableKeys
Collection<String> getAvailableKeys()- Returns:
- all of the defined keys.
-
createDiff
TranslationPackageDiff createDiff()Creates an empty, modifiable diff that respects the same rules as this translation package. A diff is used to track changes relative to this package.- Returns:
- a new
TranslationPackageDiff.
-
getAllTranslations
Iterator<Translation> getAllTranslations()- Returns:
- an iterator that goes through all of the translations. Does not include defined keys that have no translations.
-