Class DelegateTranslationPackage
java.lang.Object
com.inductiveautomation.ignition.common.i18n.translation.DelegateTranslationPackage
- All Implemented Interfaces:
MutableTranslationPackage,TranslationPackage
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidEnsures that the specified key is in the translation package.voidaddTranslation(String key, Locale locale, String value) Sets a translation for the specified key and locale.voidaddTranslations(String key, TranslationMap translations) Sets all of the translations for a specific key.Creates an empty, modifiable diff that respects the same rules as this translation package.voidensureLocaleExists(Locale locale) Verifies that the locale is present, adding it if necessary.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.booleanRemoves the specific key, and any translations.voidremoveLocale(Locale locale) voidremoveTranslation(String key, Locale locale) Removes a translation for a specified key and locale.void
-
Constructor Details
-
DelegateTranslationPackage
public DelegateTranslationPackage()
-
-
Method Details
-
setDelegatePackage
-
getKeyHashRule
Description 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 interfaceTranslationPackage
-
addTerm
Description copied from interface:MutableTranslationPackageEnsures that the specified key is in the translation package. This registers a key without necessarily providing a translation immediately.- Specified by:
addTermin interfaceMutableTranslationPackage- Parameters:
key- The key to add.
-
addTranslation
Description copied from interface:MutableTranslationPackageSets a translation for the specified key and locale.- Specified by:
addTranslationin interfaceMutableTranslationPackage- Parameters:
key- The key to translate.locale- The target locale.value- The translated string.
-
removeTranslation
Description copied from interface:MutableTranslationPackageRemoves a translation for a specified key and locale. Used when someone had a translation and blanks it out. This removes the specific translation but keeps the key in the package.- Specified by:
removeTranslationin interfaceMutableTranslationPackage- Parameters:
key- The key to modify.locale- The locale for which to remove the translation.
-
getBaseLocale
- Specified by:
getBaseLocalein interfaceTranslationPackage- Returns:
- the "base" locale, the language in which the terms are defined.
-
addTranslations
Description 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 interfaceMutableTranslationPackage
-
getAvailableLocales
- Specified by:
getAvailableLocalesin interfaceTranslationPackage- Returns:
- the locales for which translations are available. This will include the base locale.
-
isDefined
Description copied from interface:TranslationPackageReturns whether the key is defined in the package. A key can be defined without any particular translations.- Specified by:
isDefinedin interfaceTranslationPackage
-
removeKey
Description copied from interface:MutableTranslationPackageRemoves the specific key, and any translations.- Specified by:
removeKeyin interfaceMutableTranslationPackage- Returns:
- true if key was present
-
isDefined
Description copied from interface:TranslationPackageReturns whether there is a translation defined for the given key in the given locale.- Specified by:
isDefinedin interfaceTranslationPackage
-
ensureLocaleExists
Description copied from interface:MutableTranslationPackageVerifies that the locale is present, adding it if necessary.- Specified by:
ensureLocaleExistsin interfaceMutableTranslationPackage
-
removeLocale
- Specified by:
removeLocalein interfaceMutableTranslationPackage
-
get
Description copied from interface:TranslationPackageTranslates the given key into the requested locale.- Specified by:
getin interfaceTranslationPackage- 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
Description copied from interface:TranslationPackageTranslates the given key into the requested locale, returning null if no translation exists.- Specified by:
getStrictin interfaceTranslationPackage- 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
- Specified by:
getTranslationsForin interfaceTranslationPackage- Returns:
- a map of all of the translations available for a given key.
-
getAvailableKeys
- Specified by:
getAvailableKeysin interfaceTranslationPackage- Returns:
- all of the defined keys.
-
createDiff
Description copied from interface:TranslationPackageCreates an empty, modifiable diff that respects the same rules as this translation package. A diff is used to track changes relative to this package.- Specified by:
createDiffin interfaceTranslationPackage- Returns:
- a new
TranslationPackageDiff.
-
getAllTranslations
- Specified by:
getAllTranslationsin interfaceTranslationPackage- Returns:
- an iterator that goes through all of the translations. Does not include defined keys that have no translations.
-