public class DesignerLocalizationManager extends ClientLocalizationManager implements MutableTranslationPackage
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PREVIEW_LOCALE |
_instance, EVENT_AVAILABLE_LOCALES, EVENT_TRANSLATIONS
Modifier and Type | Method and Description |
---|---|
void |
addLocaleListener(LocaleListener listener) |
void |
addTerm(java.lang.String term)
Ensures that the specified key is in the translation package.
|
void |
addTranslation(java.lang.String key,
java.util.Locale locale,
java.lang.String value)
Sets a translation for the specified key and locale.
|
void |
addTranslations(java.lang.String key,
TranslationMap translations)
Sets all of the translations for a specific key.
|
protected boolean |
areLocaleSetsDifferent(java.util.Collection<java.util.Locale> a,
java.util.Collection<java.util.Locale> b) |
boolean |
areSettingsDefined(java.util.Locale locale) |
TranslationPackageDiff |
createDiff()
Returns an empty, modifiable diff that respects the same rules as the translation package.
|
void |
ensureLocaleExists(java.util.Locale locale)
Verifies that the locale is present, adding it if necessary.
|
protected void |
fireLocaleChanged() |
static DesignerLocalizationManager |
get() |
java.lang.String |
get(java.util.Locale locale,
java.lang.String key)
Returns the translation of the key for the requested locale, or the key, if the translation is not available.
|
java.util.Iterator<Translation> |
getAllTranslations()
Returns an iterator that goes through all of the translations.
|
java.util.Collection<java.lang.String> |
getAvailableKeys()
Returns all of the defined keys.
|
java.util.Collection<java.util.Locale> |
getAvailableLocales()
Returns the locales for which translations are available.
|
java.util.Locale |
getBaseLocale()
Returns the "base" locale, the language in which the terms are defined.
|
java.util.Locale |
getCurrentLocale() |
protected TranslationPackageDiff |
getEdit() |
KeyHashRule |
getKeyHashRule()
The key hash rule dictates how term equivalency is calculated.
|
java.util.Locale |
getPreviewLocale() |
java.util.Collection<RegionalSettings> |
getRegionalSettings() |
protected RegionalSettingsDiff |
getSettingsEdit() |
RegionalSettings |
getSettingsFor(java.util.Locale locale)
Returns the settings for the locale.
|
protected RegionalSettings |
getSettingsFor(java.util.Locale locale,
boolean strict) |
java.lang.String |
getStrict(java.util.Locale locale,
java.lang.String key)
Returns the translation, or null if the translation doesn't exist.
|
java.lang.String |
getStrict(java.lang.String key) |
java.lang.String |
getString(java.lang.String key) |
java.lang.String |
getStringForBundleKey(java.lang.String bundlekey) |
TranslationSettings |
getTranslationSettings() |
TranslationMap |
getTranslationsFor(java.lang.String key)
Returns a map of all of the translations available for a given key.
|
protected boolean |
hasChanges() |
boolean |
isDefined(java.lang.String key)
Returns whether the key is defined in the package.
|
boolean |
isDefined(java.lang.String key,
java.util.Locale l)
Returns whether there is a translation defined for the given key in the given locale.
|
boolean |
isTranslationEnabled() |
void |
modifyRegionalSettings(RegionalSettings settings) |
protected void |
onEditStateChanged() |
protected void |
refreshModel() |
boolean |
removeKey(java.lang.String key)
Removes the specific key, and any translations.
|
void |
removeLocale(java.util.Locale locale) |
void |
removeLocaleListener(LocaleListener listener) |
void |
removeTranslation(java.lang.String key,
java.util.Locale locale)
Removes a translation for a specified key and locale.
|
void |
resetLocale()
Resets the current locale to the base locale.
|
protected void |
saveChanges() |
void |
saveTranslationSettings(TranslationSettings settings) |
void |
setCurrentLocale(java.util.Locale locale) |
void |
setEnabled(boolean value)
Sets whether the localization manager should be used.
|
protected void |
setModel(TranslationPackage value) |
void |
setPreviewLocale(java.lang.String localeName) |
protected void |
setSettings(java.util.Collection<RegionalSettings> settings) |
void |
setup(DesignerContext context) |
addPropertyChangeListener, fireProperty, removePropertyChangeListener, set
public static final java.lang.String PREVIEW_LOCALE
public static DesignerLocalizationManager get()
public boolean isTranslationEnabled()
isTranslationEnabled
in class ClientLocalizationManager
public java.util.Collection<java.util.Locale> getAvailableLocales()
TranslationPackage
getAvailableLocales
in interface TranslationPackage
getAvailableLocales
in class ClientLocalizationManager
public java.lang.String get(java.util.Locale locale, java.lang.String key)
TranslationPackage
get
in interface TranslationPackage
get
in class ClientLocalizationManager
public java.lang.String getString(java.lang.String key)
getString
in class ClientLocalizationManager
public java.lang.String getStrict(java.lang.String key)
getStrict
in class ClientLocalizationManager
public java.lang.String getStrict(java.util.Locale locale, java.lang.String key)
TranslationPackage
getStrict
in interface TranslationPackage
getStrict
in class ClientLocalizationManager
public java.lang.String getStringForBundleKey(java.lang.String bundlekey)
getStringForBundleKey
in class ClientLocalizationManager
public TranslationMap getTranslationsFor(java.lang.String key)
TranslationPackage
getTranslationsFor
in interface TranslationPackage
getTranslationsFor
in class ClientLocalizationManager
public java.util.Locale getCurrentLocale()
getCurrentLocale
in class ClientLocalizationManager
public void setCurrentLocale(java.util.Locale locale)
setCurrentLocale
in class ClientLocalizationManager
public void addLocaleListener(LocaleListener listener)
addLocaleListener
in class ClientLocalizationManager
public void removeLocaleListener(LocaleListener listener)
removeLocaleListener
in class ClientLocalizationManager
public void resetLocale()
ClientLocalizationManager
resetLocale
in class ClientLocalizationManager
public void setEnabled(boolean value)
value
- public void setup(DesignerContext context)
protected void refreshModel()
protected void setModel(TranslationPackage value)
protected void setSettings(java.util.Collection<RegionalSettings> settings)
protected TranslationPackageDiff getEdit()
protected RegionalSettingsDiff getSettingsEdit()
protected boolean hasChanges()
public void addTerm(java.lang.String term)
MutableTranslationPackage
addTerm
in interface MutableTranslationPackage
public void addTranslation(java.lang.String key, java.util.Locale locale, java.lang.String value)
MutableTranslationPackage
addTranslation
in interface MutableTranslationPackage
public void removeTranslation(java.lang.String key, java.util.Locale locale)
MutableTranslationPackage
removeTranslation
in interface MutableTranslationPackage
public void addTranslations(java.lang.String key, TranslationMap translations)
MutableTranslationPackage
addTranslations
in interface MutableTranslationPackage
public boolean removeKey(java.lang.String key)
MutableTranslationPackage
removeKey
in interface MutableTranslationPackage
public void ensureLocaleExists(java.util.Locale locale)
MutableTranslationPackage
ensureLocaleExists
in interface MutableTranslationPackage
public void removeLocale(java.util.Locale locale)
removeLocale
in interface MutableTranslationPackage
public java.util.Locale getBaseLocale()
TranslationPackage
getBaseLocale
in interface TranslationPackage
public KeyHashRule getKeyHashRule()
TranslationPackage
getKeyHashRule
in interface TranslationPackage
public boolean isDefined(java.lang.String key)
TranslationPackage
isDefined
in interface TranslationPackage
public boolean isDefined(java.lang.String key, java.util.Locale l)
TranslationPackage
isDefined
in interface TranslationPackage
public java.util.Collection<java.lang.String> getAvailableKeys()
TranslationPackage
getAvailableKeys
in interface TranslationPackage
public TranslationPackageDiff createDiff()
TranslationPackage
createDiff
in interface TranslationPackage
public java.util.Iterator<Translation> getAllTranslations()
TranslationPackage
getAllTranslations
in interface TranslationPackage
public RegionalSettings getSettingsFor(java.util.Locale locale)
locale
- protected RegionalSettings getSettingsFor(java.util.Locale locale, boolean strict)
public boolean areSettingsDefined(java.util.Locale locale)
public java.util.Collection<RegionalSettings> getRegionalSettings()
public void modifyRegionalSettings(RegionalSettings settings)
public TranslationSettings getTranslationSettings()
public void saveTranslationSettings(TranslationSettings settings)
public java.util.Locale getPreviewLocale()
getPreviewLocale
in class ClientLocalizationManager
public void setPreviewLocale(java.lang.String localeName)
protected void fireLocaleChanged()
protected void onEditStateChanged()
protected boolean areLocaleSetsDifferent(java.util.Collection<java.util.Locale> a, java.util.Collection<java.util.Locale> b)
protected void saveChanges()