Class DesignerLocalizationManager
java.lang.Object
com.inductiveautomation.ignition.client.model.ClientLocalizationManager
com.inductiveautomation.ignition.designer.i18n.DesignerLocalizationManager
- All Implemented Interfaces:
MutableTranslationPackage,TranslationPackage,Serializable
public class DesignerLocalizationManager
extends ClientLocalizationManager
implements MutableTranslationPackage
- See Also:
-
Field Summary
FieldsFields inherited from class com.inductiveautomation.ignition.client.model.ClientLocalizationManager
_instance, EVENT_AVAILABLE_LOCALES, EVENT_TRANSLATIONS -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLocaleListener(LocaleListener listener) voidEnsures 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.protected booleanbooleanareSettingsDefined(Locale locale) voidensureLocaleExists(Locale locale) Verifies that the locale is present, adding it if necessary.protected voidstatic DesignerLocalizationManagerget()protected TranslationPackageDiffgetEdit()The key hash rule dictates how term equivalency is calculated.protected RegionalSettingsDiffgetSettingsFor(Locale locale) Returns the settings for the locale.protected RegionalSettingsgetSettingsFor(Locale locale, boolean strict) getStringForBundleKey(String bundlekey) getTranslationsFor(String key) protected booleanbooleanReturns whether the key is defined in the package.booleanReturns whether there is a translation defined for the given key in the given locale.booleanvoidmodifyRegionalSettings(RegionalSettings settings) protected voidprotected voidbooleanRemoves the specific key, and any translations.voidremoveLocale(Locale locale) voidremoveLocaleListener(LocaleListener listener) voidremoveTranslation(String key, Locale locale) Removes a translation for a specified key and locale.voidResets the current locale to the base locale.protected voidvoidsaveTranslationSettings(TranslationSettings settings) voidsetCurrentLocale(Locale locale) voidsetEnabled(boolean value) Sets whether the localization manager should be used.protected voidsetModel(TranslationPackage value) voidsetPreviewLocale(String localeName) protected voidsetSettings(Collection<RegionalSettings> settings) voidsetup(DesignerContext context) Methods inherited from class com.inductiveautomation.ignition.client.model.ClientLocalizationManager
addPropertyChangeListener, fireProperty, removePropertyChangeListener, set
-
Field Details
-
PREVIEW_LOCALE
- See Also:
-
-
Method Details
-
get
-
isTranslationEnabled
public boolean isTranslationEnabled()- Specified by:
isTranslationEnabledin classClientLocalizationManager
-
getAvailableLocales
- Specified by:
getAvailableLocalesin interfaceTranslationPackage- Specified by:
getAvailableLocalesin classClientLocalizationManager- Returns:
- the locales for which translations are available. This will include the base locale.
-
get
- Specified by:
getin interfaceTranslationPackage- Specified by:
getin classClientLocalizationManagerkey- 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.
-
getString
- Specified by:
getStringin classClientLocalizationManager
-
getStrict
- Specified by:
getStrictin classClientLocalizationManager
-
getStrict
- Specified by:
getStrictin interfaceTranslationPackage- Specified by:
getStrictin classClientLocalizationManager- 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.
-
getStringForBundleKey
- Specified by:
getStringForBundleKeyin classClientLocalizationManager
-
getTranslationsFor
- Specified by:
getTranslationsForin interfaceTranslationPackage- Specified by:
getTranslationsForin classClientLocalizationManager- Returns:
- a map of all of the translations available for a given key.
-
getCurrentLocale
- Specified by:
getCurrentLocalein classClientLocalizationManager
-
setCurrentLocale
- Specified by:
setCurrentLocalein classClientLocalizationManager
-
addLocaleListener
- Specified by:
addLocaleListenerin classClientLocalizationManager
-
removeLocaleListener
- Specified by:
removeLocaleListenerin classClientLocalizationManager
-
resetLocale
public void resetLocale()Description copied from class:ClientLocalizationManagerResets the current locale to the base locale. *- Specified by:
resetLocalein classClientLocalizationManager
-
setEnabled
public void setEnabled(boolean value) Sets whether the localization manager should be used. If false, returns translations as if the current locale was the default locale. However, doesn't fire events like setting the locale. Used especially to save projects. -
setup
-
refreshModel
protected void refreshModel() -
setModel
-
setSettings
-
getEdit
-
getSettingsEdit
-
hasChanges
protected boolean hasChanges() -
addTerm
Description copied from interface:MutableTranslationPackageEnsures that the specified key is in the translation package.- Specified by:
addTermin interfaceMutableTranslationPackage
-
addTranslation
Description copied from interface:MutableTranslationPackageSets a translation for the specified key and locale.- Specified by:
addTranslationin interfaceMutableTranslationPackage
-
removeTranslation
Description 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 interfaceMutableTranslationPackage
-
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
-
removeKey
Description copied from interface:MutableTranslationPackageRemoves the specific key, and any translations.- Specified by:
removeKeyin interfaceMutableTranslationPackage- Returns:
- true if key was present
-
ensureLocaleExists
Description copied from interface:MutableTranslationPackageVerifies that the locale is present, adding it if necessary.- Specified by:
ensureLocaleExistsin interfaceMutableTranslationPackage
-
removeLocale
- Specified by:
removeLocalein interfaceMutableTranslationPackage
-
getBaseLocale
- Specified by:
getBaseLocalein interfaceTranslationPackage- Returns:
- the "base" locale, the language in which the terms are defined.
-
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
-
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
-
isDefined
Description copied from interface:TranslationPackageReturns whether there is a translation defined for the given key in the given locale.- Specified by:
isDefinedin interfaceTranslationPackage
-
getAvailableKeys
- Specified by:
getAvailableKeysin interfaceTranslationPackage- Returns:
- all of the defined keys.
-
createDiff
- Specified by:
createDiffin interfaceTranslationPackage- Returns:
- an empty, modifiable diff that respects the same rules as the translation package.
-
getAllTranslations
- Specified by:
getAllTranslationsin interfaceTranslationPackage- Returns:
- an iterator that goes through all of the translations. Does not include defined keys that have no translations.
-
getSettingsFor
Returns the settings for the locale. If necessary, will create default settings to return. Therefore, do not use this to see if settings are defined. -
getSettingsFor
-
areSettingsDefined
-
getRegionalSettings
-
modifyRegionalSettings
-
getTranslationSettings
-
saveTranslationSettings
-
getPreviewLocale
- Specified by:
getPreviewLocalein classClientLocalizationManager
-
setPreviewLocale
-
fireLocaleChanged
protected void fireLocaleChanged() -
onEditStateChanged
protected void onEditStateChanged() -
areLocaleSetsDifferent
-
saveChanges
protected void saveChanges()
-