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 TypeMethodDescriptionvoid
addLocaleListener
(LocaleListener listener) void
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.protected boolean
boolean
areSettingsDefined
(Locale locale) void
ensureLocaleExists
(Locale locale) Verifies that the locale is present, adding it if necessary.protected void
static DesignerLocalizationManager
get()
protected TranslationPackageDiff
getEdit()
The key hash rule dictates how term equivalency is calculated.protected RegionalSettingsDiff
getSettingsFor
(Locale locale) Returns the settings for the locale.protected RegionalSettings
getSettingsFor
(Locale locale, boolean strict) getStringForBundleKey
(String bundlekey) getTranslationsFor
(String key) protected boolean
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
void
modifyRegionalSettings
(RegionalSettings settings) protected void
protected void
boolean
Removes the specific key, and any translations.void
removeLocale
(Locale locale) void
removeLocaleListener
(LocaleListener listener) void
removeTranslation
(String key, Locale locale) Removes a translation for a specified key and locale.void
Resets the current locale to the base locale.protected void
void
saveTranslationSettings
(TranslationSettings settings) void
setCurrentLocale
(Locale locale) void
setEnabled
(boolean value) Sets whether the localization manager should be used.protected void
setModel
(TranslationPackage value) void
setPreviewLocale
(String localeName) protected void
setSettings
(Collection<RegionalSettings> settings) void
setup
(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:
isTranslationEnabled
in classClientLocalizationManager
-
getAvailableLocales
- Specified by:
getAvailableLocales
in interfaceTranslationPackage
- Specified by:
getAvailableLocales
in classClientLocalizationManager
- Returns:
- the locales for which translations are available. This will include the base locale.
-
get
- Specified by:
get
in interfaceTranslationPackage
- Specified by:
get
in classClientLocalizationManager
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.
-
getString
- Specified by:
getString
in classClientLocalizationManager
-
getStrict
- Specified by:
getStrict
in classClientLocalizationManager
-
getStrict
- Specified by:
getStrict
in interfaceTranslationPackage
- Specified by:
getStrict
in 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:
getStringForBundleKey
in classClientLocalizationManager
-
getTranslationsFor
- Specified by:
getTranslationsFor
in interfaceTranslationPackage
- Specified by:
getTranslationsFor
in classClientLocalizationManager
- Returns:
- a map of all of the translations available for a given key.
-
getCurrentLocale
- Specified by:
getCurrentLocale
in classClientLocalizationManager
-
setCurrentLocale
- Specified by:
setCurrentLocale
in classClientLocalizationManager
-
addLocaleListener
- Specified by:
addLocaleListener
in classClientLocalizationManager
-
removeLocaleListener
- Specified by:
removeLocaleListener
in classClientLocalizationManager
-
resetLocale
public void resetLocale()Description copied from class:ClientLocalizationManager
Resets the current locale to the base locale. *- Specified by:
resetLocale
in 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: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
-
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
-
removeKey
Description copied from interface:MutableTranslationPackage
Removes the specific key, and any translations.- Specified by:
removeKey
in interfaceMutableTranslationPackage
- Returns:
- true if key was present
-
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
-
getBaseLocale
- Specified by:
getBaseLocale
in interfaceTranslationPackage
- Returns:
- the "base" locale, the language in which the terms are defined.
-
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
-
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
-
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
-
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.
-
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:
getPreviewLocale
in classClientLocalizationManager
-
setPreviewLocale
-
fireLocaleChanged
protected void fireLocaleChanged() -
onEditStateChanged
protected void onEditStateChanged() -
areLocaleSetsDifferent
-
saveChanges
protected void saveChanges()
-