Class DesignerLocalizationManager
- java.lang.Object
- 
- com.inductiveautomation.ignition.client.model.ClientLocalizationManager
- 
- com.inductiveautomation.ignition.designer.i18n.DesignerLocalizationManager
 
 
- 
- All Implemented Interfaces:
- MutableTranslationPackage,- TranslationPackage,- java.io.Serializable
 
 public class DesignerLocalizationManager extends ClientLocalizationManager implements MutableTranslationPackage - See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description static java.lang.StringPREVIEW_LOCALE- 
Fields inherited from class com.inductiveautomation.ignition.client.model.ClientLocalizationManager_instance, EVENT_AVAILABLE_LOCALES, EVENT_TRANSLATIONS
 
- 
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddLocaleListener(LocaleListener listener)voidaddTerm(java.lang.String term)Ensures that the specified key is in the translation package.voidaddTranslation(java.lang.String key, java.util.Locale locale, java.lang.String value)Sets a translation for the specified key and locale.voidaddTranslations(java.lang.String key, TranslationMap translations)Sets all of the translations for a specific key.protected booleanareLocaleSetsDifferent(java.util.Collection<java.util.Locale> a, java.util.Collection<java.util.Locale> b)booleanareSettingsDefined(java.util.Locale locale)TranslationPackageDiffcreateDiff()voidensureLocaleExists(java.util.Locale locale)Verifies that the locale is present, adding it if necessary.protected voidfireLocaleChanged()static DesignerLocalizationManagerget()java.lang.Stringget(java.util.Locale locale, java.lang.String key)java.util.Iterator<Translation>getAllTranslations()java.util.Collection<java.lang.String>getAvailableKeys()java.util.Collection<java.util.Locale>getAvailableLocales()java.util.LocalegetBaseLocale()java.util.LocalegetCurrentLocale()protected TranslationPackageDiffgetEdit()KeyHashRulegetKeyHashRule()The key hash rule dictates how term equivalency is calculated.java.util.LocalegetPreviewLocale()java.util.Collection<RegionalSettings>getRegionalSettings()protected RegionalSettingsDiffgetSettingsEdit()RegionalSettingsgetSettingsFor(java.util.Locale locale)Returns the settings for the locale.protected RegionalSettingsgetSettingsFor(java.util.Locale locale, boolean strict)java.lang.StringgetStrict(java.lang.String key)java.lang.StringgetStrict(java.util.Locale locale, java.lang.String key)java.lang.StringgetString(java.lang.String key)java.lang.StringgetStringForBundleKey(java.lang.String bundlekey)TranslationSettingsgetTranslationSettings()TranslationMapgetTranslationsFor(java.lang.String key)protected booleanhasChanges()booleanisDefined(java.lang.String key)Returns whether the key is defined in the package.booleanisDefined(java.lang.String key, java.util.Locale l)Returns whether there is a translation defined for the given key in the given locale.booleanisTranslationEnabled()voidmodifyRegionalSettings(RegionalSettings settings)protected voidonEditStateChanged()protected voidrefreshModel()booleanremoveKey(java.lang.String key)Removes the specific key, and any translations.voidremoveLocale(java.util.Locale locale)voidremoveLocaleListener(LocaleListener listener)voidremoveTranslation(java.lang.String key, java.util.Locale locale)Removes a translation for a specified key and locale.voidresetLocale()Resets the current locale to the base locale.protected voidsaveChanges()voidsaveTranslationSettings(TranslationSettings settings)voidsetCurrentLocale(java.util.Locale locale)voidsetEnabled(boolean value)Sets whether the localization manager should be used.protected voidsetModel(TranslationPackage value)voidsetPreviewLocale(java.lang.String localeName)protected voidsetSettings(java.util.Collection<RegionalSettings> settings)voidsetup(DesignerContext context)- 
Methods inherited from class com.inductiveautomation.ignition.client.model.ClientLocalizationManageraddPropertyChangeListener, fireProperty, removePropertyChangeListener, set
 
- 
 
- 
- 
- 
Field Detail- 
PREVIEW_LOCALEpublic static final java.lang.String PREVIEW_LOCALE - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getpublic static DesignerLocalizationManager get() 
 - 
isTranslationEnabledpublic boolean isTranslationEnabled() - Specified by:
- isTranslationEnabledin class- ClientLocalizationManager
 
 - 
getAvailableLocalespublic java.util.Collection<java.util.Locale> getAvailableLocales() - Specified by:
- getAvailableLocalesin interface- TranslationPackage
- Specified by:
- getAvailableLocalesin class- ClientLocalizationManager
- Returns:
- the locales for which translations are available. This will include the base locale.
 
 - 
getpublic java.lang.String get(java.util.Locale locale, java.lang.String key)- Specified by:
- getin interface- TranslationPackage
- Specified by:
- getin class- ClientLocalizationManager
- 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.
 
 - 
getStringpublic java.lang.String getString(java.lang.String key) - Specified by:
- getStringin class- ClientLocalizationManager
 
 - 
getStrictpublic java.lang.String getStrict(java.lang.String key) - Specified by:
- getStrictin class- ClientLocalizationManager
 
 - 
getStrictpublic java.lang.String getStrict(java.util.Locale locale, java.lang.String key)- Specified by:
- getStrictin interface- TranslationPackage
- Specified by:
- getStrictin class- ClientLocalizationManager
- 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.
 
 - 
getStringForBundleKeypublic java.lang.String getStringForBundleKey(java.lang.String bundlekey) - Specified by:
- getStringForBundleKeyin class- ClientLocalizationManager
 
 - 
getTranslationsForpublic TranslationMap getTranslationsFor(java.lang.String key) - Specified by:
- getTranslationsForin interface- TranslationPackage
- Specified by:
- getTranslationsForin class- ClientLocalizationManager
- Returns:
- a map of all of the translations available for a given key.
 
 - 
getCurrentLocalepublic java.util.Locale getCurrentLocale() - Specified by:
- getCurrentLocalein class- ClientLocalizationManager
 
 - 
setCurrentLocalepublic void setCurrentLocale(java.util.Locale locale) - Specified by:
- setCurrentLocalein class- ClientLocalizationManager
 
 - 
addLocaleListenerpublic void addLocaleListener(LocaleListener listener) - Specified by:
- addLocaleListenerin class- ClientLocalizationManager
 
 - 
removeLocaleListenerpublic void removeLocaleListener(LocaleListener listener) - Specified by:
- removeLocaleListenerin class- ClientLocalizationManager
 
 - 
resetLocalepublic void resetLocale() Description copied from class:ClientLocalizationManagerResets the current locale to the base locale. *- Specified by:
- resetLocalein class- ClientLocalizationManager
 
 - 
setEnabledpublic 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.
 - 
setuppublic void setup(DesignerContext context) 
 - 
refreshModelprotected void refreshModel() 
 - 
setModelprotected void setModel(TranslationPackage value) 
 - 
setSettingsprotected void setSettings(java.util.Collection<RegionalSettings> settings) 
 - 
getEditprotected TranslationPackageDiff getEdit() 
 - 
getSettingsEditprotected RegionalSettingsDiff getSettingsEdit() 
 - 
hasChangesprotected boolean hasChanges() 
 - 
addTermpublic void addTerm(java.lang.String term) Description copied from interface:MutableTranslationPackageEnsures that the specified key is in the translation package.- Specified by:
- addTermin interface- MutableTranslationPackage
 
 - 
addTranslationpublic void addTranslation(java.lang.String key, java.util.Locale locale, java.lang.String value)Description copied from interface:MutableTranslationPackageSets a translation for the specified key and locale.- Specified by:
- addTranslationin interface- MutableTranslationPackage
 
 - 
removeTranslationpublic void removeTranslation(java.lang.String key, java.util.Locale locale)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 interface- MutableTranslationPackage
 
 - 
addTranslationspublic void addTranslations(java.lang.String key, TranslationMap translations)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 interface- MutableTranslationPackage
 
 - 
removeKeypublic boolean removeKey(java.lang.String key) Description copied from interface:MutableTranslationPackageRemoves the specific key, and any translations.- Specified by:
- removeKeyin interface- MutableTranslationPackage
- Returns:
- true if key was present
 
 - 
ensureLocaleExistspublic void ensureLocaleExists(java.util.Locale locale) Description copied from interface:MutableTranslationPackageVerifies that the locale is present, adding it if necessary.- Specified by:
- ensureLocaleExistsin interface- MutableTranslationPackage
 
 - 
removeLocalepublic void removeLocale(java.util.Locale locale) - Specified by:
- removeLocalein interface- MutableTranslationPackage
 
 - 
getBaseLocalepublic java.util.Locale getBaseLocale() - Specified by:
- getBaseLocalein interface- TranslationPackage
- Returns:
- the "base" locale, the language in which the terms are defined.
 
 - 
getKeyHashRulepublic KeyHashRule 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 interface- TranslationPackage
 
 - 
isDefinedpublic boolean isDefined(java.lang.String key) 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 interface- TranslationPackage
 
 - 
isDefinedpublic boolean isDefined(java.lang.String key, java.util.Locale l)Description copied from interface:TranslationPackageReturns whether there is a translation defined for the given key in the given locale.- Specified by:
- isDefinedin interface- TranslationPackage
 
 - 
getAvailableKeyspublic java.util.Collection<java.lang.String> getAvailableKeys() - Specified by:
- getAvailableKeysin interface- TranslationPackage
- Returns:
- all of the defined keys.
 
 - 
createDiffpublic TranslationPackageDiff createDiff() - Specified by:
- createDiffin interface- TranslationPackage
- Returns:
- an empty, modifiable diff that respects the same rules as the translation package.
 
 - 
getAllTranslationspublic java.util.Iterator<Translation> 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.
 
 - 
getSettingsForpublic RegionalSettings getSettingsFor(java.util.Locale locale) 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.
 - 
getSettingsForprotected RegionalSettings getSettingsFor(java.util.Locale locale, boolean strict) 
 - 
areSettingsDefinedpublic boolean areSettingsDefined(java.util.Locale locale) 
 - 
getRegionalSettingspublic java.util.Collection<RegionalSettings> getRegionalSettings() 
 - 
modifyRegionalSettingspublic void modifyRegionalSettings(RegionalSettings settings) 
 - 
getTranslationSettingspublic TranslationSettings getTranslationSettings() 
 - 
saveTranslationSettingspublic void saveTranslationSettings(TranslationSettings settings) 
 - 
getPreviewLocalepublic java.util.Locale getPreviewLocale() - Specified by:
- getPreviewLocalein class- ClientLocalizationManager
 
 - 
setPreviewLocalepublic void setPreviewLocale(java.lang.String localeName) 
 - 
fireLocaleChangedprotected void fireLocaleChanged() 
 - 
onEditStateChangedprotected void onEditStateChanged() 
 - 
areLocaleSetsDifferentprotected boolean areLocaleSetsDifferent(java.util.Collection<java.util.Locale> a, java.util.Collection<java.util.Locale> b)
 - 
saveChangesprotected void saveChanges() 
 
- 
 
-