public class ClientLocalizationManagerImpl extends ClientLocalizationManager
_instance, EVENT_AVAILABLE_LOCALES, EVENT_TRANSLATIONS
Constructor and Description |
---|
ClientLocalizationManagerImpl(ClientContextImpl context) |
Modifier and Type | Method and Description |
---|---|
void |
addLocaleListener(LocaleListener listener) |
TranslationPackageDiff |
createDiff()
Returns an empty, modifiable diff that respects the same rules as the translation package.
|
protected void |
fireLocaleChanged() |
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() |
KeyHashRule |
getKeyHashRule()
The key hash rule dictates how term equivalency is calculated.
|
java.util.Locale |
getPreviewLocale() |
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) |
TranslationMap |
getTranslationsFor(java.lang.String key)
Returns a map of all of the translations available for a given key.
|
void |
initNotificationListener() |
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 |
loadTranslationDatabase(java.io.File location)
This functions loads the term db from a file, which should be a serialized TranslationPackage.
|
void |
removeLocaleListener(LocaleListener listener) |
void |
resetLocale()
Resets the current locale to the base locale.
|
void |
setCurrentLocale(java.util.Locale locale) |
addPropertyChangeListener, fireProperty, get, removePropertyChangeListener, set
public ClientLocalizationManagerImpl(ClientContextImpl context)
public void initNotificationListener()
public void loadTranslationDatabase(java.io.File location)
location
- public boolean isTranslationEnabled()
isTranslationEnabled
in class ClientLocalizationManager
public java.util.Locale getBaseLocale()
TranslationPackage
public KeyHashRule getKeyHashRule()
TranslationPackage
public java.util.Collection<java.util.Locale> getAvailableLocales()
TranslationPackage
getAvailableLocales
in interface TranslationPackage
getAvailableLocales
in class ClientLocalizationManager
public boolean isDefined(java.lang.String key)
TranslationPackage
public boolean isDefined(java.lang.String key, java.util.Locale l)
TranslationPackage
public java.util.Locale getCurrentLocale()
getCurrentLocale
in class ClientLocalizationManager
public void setCurrentLocale(java.util.Locale locale)
setCurrentLocale
in class ClientLocalizationManager
public java.util.Locale getPreviewLocale()
getPreviewLocale
in class ClientLocalizationManager
public void resetLocale()
ClientLocalizationManager
resetLocale
in class ClientLocalizationManager
public java.lang.String getString(java.lang.String key)
getString
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 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.Collection<java.lang.String> getAvailableKeys()
TranslationPackage
public TranslationPackageDiff createDiff()
TranslationPackage
public java.util.Iterator<Translation> getAllTranslations()
TranslationPackage
public void addLocaleListener(LocaleListener listener)
addLocaleListener
in class ClientLocalizationManager
public void removeLocaleListener(LocaleListener listener)
removeLocaleListener
in class ClientLocalizationManager
protected void fireLocaleChanged()