Class BasicTranslationPackage
java.lang.Object
com.inductiveautomation.ignition.common.i18n.translation.BasicTranslationPackage
- All Implemented Interfaces:
- MutableTranslationPackage,- TranslationPackage,- Serializable
- Direct Known Subclasses:
- TranslationPackageDiff
A translation package holds the keys and one or more translations for the keys.
- See Also:
- 
Nested Class SummaryNested Classes
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidEnsures that the specified key is in the translation package.voidaddTranslation(String term, Locale targetLocale, String translation) Sets a translation for the specified key and locale.voidaddTranslations(String key, TranslationMap translations) Sets all of the translations for a specific key.voidCan merge an existing translation package into this one.voidensureLocaleExists(Locale locale) Verifies that the locale is present, adding it if necessary.booleanReturns the translation of the key for the requested locale, or the key, if the translation is not available.getIndex()The key hash rule dictates how term equivalency is calculated.protected TermKeygetOrCreateTermKey(String term) protected StringReturns the translation, or null.protected TermKeygetTermKey(String term) getTranslationsFor(String key) protected StringReturns the hashKey for the term *booleanReturns whether the key is defined in the package.booleanReturns whether there is a translation defined for the given key in the given locale.booleanRemoves the specific key, and any translations.voidremoveLocale(Locale locale) voidremoveTranslation(String term, Locale locale) Removes a translation for a specified key and locale.voidsetBaseLocale(Locale baseLocale) voidvoidsetKeyHashRule(KeyHashRule rule) voidupdateIndex(Collection<String> keys) 
- 
Constructor Details- 
BasicTranslationPackage
- 
BasicTranslationPackagepublic BasicTranslationPackage()
- 
BasicTranslationPackage
 
- 
- 
Method Details- 
hashKeyReturns the hashKey for the term *
- 
getTermKey
- 
getOrCreateTermKey
- 
getIndex
- 
setIndex
- 
getKeyHashRuleDescription copied from interface:TranslationPackageThe 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.- Specified by:
- getKeyHashRulein interface- TranslationPackage
 
- 
setKeyHashRule
- 
getBaseLocale- Specified by:
- getBaseLocalein interface- TranslationPackage
- Returns:
- the "base" locale, the language in which the terms are defined.
 
- 
setBaseLocale
- 
getAvailableKeys- Specified by:
- getAvailableKeysin interface- TranslationPackage
- Returns:
- all of the defined keys.
 
- 
getAvailableLocales- Specified by:
- getAvailableLocalesin interface- TranslationPackage
- Returns:
- the locales for which translations are available. This will include the base locale.
 
- 
ensureLocaleExistsDescription copied from interface:MutableTranslationPackageVerifies that the locale is present, adding it if necessary.- Specified by:
- ensureLocaleExistsin interface- MutableTranslationPackage
 
- 
isDefinedDescription copied from interface:TranslationPackageReturns whether the key is defined in the package. A key can be defined without any particular translations.- Specified by:
- isDefinedin interface- TranslationPackage
 
- 
isDefinedDescription copied from interface:TranslationPackageReturns whether there is a translation defined for the given key in the given locale.- Specified by:
- isDefinedin interface- TranslationPackage
 
- 
getReturns the translation of the key for the requested locale, or the key, if the translation is not available.- Specified by:
- getin interface- TranslationPackage
- key- the key to find a match for, or return value if no value found
- Returns:
- the translation of the key for the requested locale, or the key, if the translation is not available.
 
- 
getStrict- Specified by:
- getStrictin interface- TranslationPackage
- Parameters:
- locale- the locale to find a value for
- key- the key to find a match for
- Returns:
- the translation, or null if the translation doesn't exist.
 
- 
getOrNullReturns the translation, or null. This is true even for the base locale, in which case we would be trying to look up the "alternate".
- 
getBundle
- 
getOrCreateBundle
- 
updateIndex
- 
createDiff- Specified by:
- createDiffin interface- TranslationPackage
- Returns:
- an empty, modifiable diff that respects the same rules as the translation package.
 
- 
applyPackageCan merge an existing translation package into this one. Also, if tp is a TranslationPackageDiff, will remove the removed terms as well.
- 
getTranslationsFor- Specified by:
- getTranslationsForin interface- TranslationPackage
- Returns:
- a map of all of the translations available for a given key.
 
- 
getAllTranslations- Specified by:
- getAllTranslationsin interface- TranslationPackage
- Returns:
- an iterator that goes through all of the translations. Does not include defined keys that have no translations.
 
- 
addTranslationDescription copied from interface:MutableTranslationPackageSets a translation for the specified key and locale.- Specified by:
- addTranslationin interface- MutableTranslationPackage
 
- 
removeTranslationDescription copied from interface:MutableTranslationPackageRemoves a translation for a specified key and locale. Used when someone had a translation and blanks it out.- Specified by:
- removeTranslationin interface- MutableTranslationPackage
 
- 
addTermDescription copied from interface:MutableTranslationPackageEnsures that the specified key is in the translation package.- Specified by:
- addTermin interface- MutableTranslationPackage
 
- 
addTranslationsDescription copied from interface:MutableTranslationPackageSets all of the translations for a specific key. Translation map can be null, in which case the key will simply be registered in the index.- Specified by:
- addTranslationsin interface- MutableTranslationPackage
 
- 
removeKeyDescription copied from interface:MutableTranslationPackageRemoves the specific key, and any translations.- Specified by:
- removeKeyin interface- MutableTranslationPackage
- Returns:
- true if key was present
 
- 
removeLocale- Specified by:
- removeLocalein interface- MutableTranslationPackage
 
- 
equals
 
-