Class DelegateTranslationPackage
java.lang.Object
com.inductiveautomation.ignition.common.i18n.translation.DelegateTranslationPackage
- All Implemented Interfaces:
MutableTranslationPackage
,TranslationPackage
,Serializable
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Ensures that the specified key is in the translation package.void
addTranslation
(String key, Locale locale, String value) Sets a translation for the specified key and locale.void
addTranslations
(String key, TranslationMap translations) Sets all of the translations for a specific key.void
ensureLocaleExists
(Locale locale) Verifies that the locale is present, adding it if necessary.The key hash rule dictates how term equivalency is calculated.getTranslationsFor
(String key) boolean
Returns whether the key is defined in the package.boolean
Returns whether there is a translation defined for the given key in the given locale.boolean
Removes the specific key, and any translations.void
removeLocale
(Locale locale) void
removeTranslation
(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:TranslationPackage
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.- Specified by:
getKeyHashRule
in interfaceTranslationPackage
-
addTerm
Description copied from interface:MutableTranslationPackage
Ensures that the specified key is in the translation package.- Specified by:
addTerm
in interfaceMutableTranslationPackage
-
addTranslation
Description copied from interface:MutableTranslationPackage
Sets a translation for the specified key and locale.- Specified by:
addTranslation
in interfaceMutableTranslationPackage
-
removeTranslation
Description copied from interface:MutableTranslationPackage
Removes a translation for a specified key and locale. Used when someone had a translation and blanks it out.- Specified by:
removeTranslation
in interfaceMutableTranslationPackage
-
getBaseLocale
- Specified by:
getBaseLocale
in interfaceTranslationPackage
- Returns:
- the "base" locale, the language in which the terms are defined.
-
addTranslations
Description copied from interface:MutableTranslationPackage
Sets 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:
addTranslations
in interfaceMutableTranslationPackage
-
getAvailableLocales
- Specified by:
getAvailableLocales
in interfaceTranslationPackage
- Returns:
- the locales for which translations are available. This will include the base locale.
-
isDefined
Description copied from interface:TranslationPackage
Returns whether the key is defined in the package. A key can be defined without any particular translations.- Specified by:
isDefined
in interfaceTranslationPackage
-
removeKey
Description copied from interface:MutableTranslationPackage
Removes the specific key, and any translations.- Specified by:
removeKey
in interfaceMutableTranslationPackage
- Returns:
- true if key was present
-
isDefined
Description copied from interface:TranslationPackage
Returns whether there is a translation defined for the given key in the given locale.- Specified by:
isDefined
in interfaceTranslationPackage
-
ensureLocaleExists
Description copied from interface:MutableTranslationPackage
Verifies that the locale is present, adding it if necessary.- Specified by:
ensureLocaleExists
in interfaceMutableTranslationPackage
-
removeLocale
- Specified by:
removeLocale
in interfaceMutableTranslationPackage
-
get
- Specified by:
get
in interfaceTranslationPackage
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:
getStrict
in 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:
getTranslationsFor
in interfaceTranslationPackage
- Returns:
- a map of all of the translations available for a given key.
-
getAvailableKeys
- Specified by:
getAvailableKeys
in interfaceTranslationPackage
- Returns:
- all of the defined keys.
-
createDiff
- Specified by:
createDiff
in interfaceTranslationPackage
- Returns:
- an empty, modifiable diff that respects the same rules as the translation package.
-
getAllTranslations
- Specified by:
getAllTranslations
in interfaceTranslationPackage
- Returns:
- an iterator that goes through all of the translations. Does not include defined keys that have no translations.
-