public static class BBTranslations
BBTranslations The BBTranslations class is a BBj CustomObject that gets and adds translations for localization support.
Modifier and Type | Field and Description |
---|---|
BBjNumber | Dirty A field variable that specifies the BBTranslations have been modified |
BBTranslations | Parent! A field variable that contains the parent translations |
com.basis.utilities.common.SortedProperties | Properties! A field variable that contains the properties |
static BBjNumber | TRANSLATION_KEY_ERROR=260 A field variable that defines the TRANSLATION_KEY_ERROR error number |
Constructor and Description |
---|
BBTranslations(BBTranslationBundle.html">BBTranslationBundle p_bundle!, BBTranslations.html">BBTranslations p_parent!, Locale p_locale!) BBTranslations constructor |
Modifier and Type | Method and Description |
---|---|
void | addChild(Locale p_locale!, BBTranslations.html">BBTranslations p_translations!) Adds a child translation to the translations |
void | addTranslation(BBjString p_key$, BBjString p_value$) Adds a translation to the translations given a key and value |
void | addTranslation(BBjString p_key$, BBjString p_value$, BBjNumber p_skip_existing) Adds a translation to the translations given a key and value, optionally skipping existing keys |
void | addTranslations(HashMap p_translations!) Adds the translations provided in the passed hash map to the translations |
void | addTranslations(HashMap p_translations!, BBjNumber p_skip_existing) Adds the translations provided in the passed hash map to the translations, optionally skipping existing entries |
Locale | findTranslationLocale(BBjString p_key$) Returns the locale that contains the passed translation key |
HashMap | getChildren() Returns the children of the translations in a HashMap |
static Locale | getClientLocale() Returns the locale used by the client |
static BBjString | getClientLocaleString() Returns the locale string used by the client |
Collection | getKeys() Returns a collection translation keys |
Locale | getLocale() Returns the locale of the translations |
BBTranslations | getParent() Returns the parent of the translations |
com.basis.utilities.common.SortedProperties | getProperties() Returns the translations properties |
BBjString | getPropertiesFileName(Locale p_locale!) Returns a properties file name |
BBjNumber | getSize() Returns the number of translations |
BBjString | getTranslation(BBjString p_key$) Returns the translated string given a key, if the translation is not found, then the passed in key is returned |
BBjString | getTranslation(BBjString p_key$, BBjString p_defaultValue!) Returns the translated string given a key, if the translation is not found, then the passed in default value is returned |
BBjString | getTranslation(BBjString p_key$, BBjString p_defaultValue!, BBjNumber p_addIfNotFound) Returns the translated string given a key, if the translation is not found, then the passed in default value is returned. The key/value can be added if not found. |
BBjString | getTranslation(BBjString p_key$, BBjString p_defaultValue!, BBjNumber p_addIfNotFound, BBjNumber p_forceAdd) Returns the translated string given a key, if the translation is not found, then the passed in default value is returned. The key/value can be added forcefully or if not found. |
BBjString | getTranslation(BBjString p_key$, BBjString p_defaultValue!, BBjNumber p_addIfNotFound, BBjNumber p_forceAdd, BBjNumber p_skipParentLocale) Returns the translated string given a key, if the translation is not found, then the passed in default value is returned. The key/value can be added forcefully or if not found. The parent locale translation can be optionally skipped. |
BBjNumber | isDefault() Returns true if this is the default translations, otherwise false is returned |
void | removeChild(Locale p_locale!) Removes a child translation from the translations |
void | removeChildren() Removes all children BBTranslationBundles |
void | removeTranslation(BBjString p_key$) Removes a translation given a key |
void | removeTranslations() Removes all translations |
void | setTranslation(BBjString p_key$, BBjString p_value$) Sets a translation value |
public BBjNumber Dirty
A field variable that specifies the BBTranslations have been modified
public BBTranslations Parent!
A field variable that contains the parent translations
public com.basis.utilities.common.SortedProperties Properties!
A field variable that contains the properties
public static BBjNumber TRANSLATION_KEY_ERROR=260
A field variable that defines the TRANSLATION_KEY_ERROR error number
public BBTranslations(BBTranslationBundle.html">BBTranslationBundle p_bundle!, BBTranslations.html">BBTranslations p_parent!, Locale p_locale!)
BBTranslations constructor
p_bundle!
Specifies the bundle in which the translations belongp_parent!
Specifies the parent translationsp_locale!
Specifies the Java locale for the translationspublic void addChild(Locale p_locale!, BBTranslations.html">BBTranslations p_translations!)
Adds a child translation to the translations
p_locale!
Specifies the Java Locale of the child translationsp_translations!
Specifies the BBTranslations object to add as a childpublic void addTranslation(BBjString p_key$, BBjString p_value$)
Adds a translation to the translations given a key and value
p_key$
Specifies the key of the translation to addp_value$
Specifies the value of the translation to addpublic void addTranslation(BBjString p_key$, BBjString p_value$, BBjNumber p_skip_existing)
Adds a translation to the translations given a key and value, optionally skipping existing keys
p_key$
Specifies the key of the translation to addp_value$
Specifies the value of the translation to addp_skip_existing
Specifies whether to skip existing keys. 0=do not skip, 1=skippublic void addTranslations(HashMap p_translations!)
Adds the translations provided in the passed hash map to the translations
p_translations!
Specifies a HashMap where the key is the Java locale and the value is the translation valuepublic void addTranslations(HashMap p_translations!, BBjNumber p_skip_existing)
Adds the translations provided in the passed hash map to the translations, optionally skipping existing entries
p_translations!
Specifies a HashMap where the key is the Java locale and the value is the translation valuep_skip_existing
Specifies whether to skip existing translations. 0=do not skip, 1=skippublic Locale findTranslationLocale(BBjString p_key$)
Returns the locale that contains the passed translation key
p_key$
Specifies the translation for the desired localepublic HashMap getChildren()
Returns the children of the translations in a HashMap
public static Locale getClientLocale()
Returns the locale used by the client
public static BBjString getClientLocaleString()
Returns the locale string used by the client
public Collection getKeys()
Returns a collection translation keys
public Locale getLocale()
Returns the locale of the translations
public BBTranslations getParent()
Returns the parent of the translations
public com.basis.utilities.common.SortedProperties getProperties()
Returns the translations properties
public BBjString getPropertiesFileName(Locale p_locale!)
Returns a properties file name
p_locale!
Specifies the Java locale for the translationspublic BBjNumber getSize()
Returns the number of translations
public BBjString getTranslation(BBjString p_key$)
Returns the translated string given a key, if the translation is not found, then the passed in key is returned
p_key$
Specifies the key to get a translationpublic BBjString getTranslation(BBjString p_key$, BBjString p_defaultValue!)
Returns the translated string given a key, if the translation is not found, then the passed in default value is returned
p_key$
Specifies the key to get a translationp_defaultValue!
Specifies the return value if the key is not found. By default, the key will be returned when not foundpublic BBjString getTranslation(BBjString p_key$, BBjString p_defaultValue!, BBjNumber p_addIfNotFound)
Returns the translated string given a key, if the translation is not found, then the passed in default value is returned. The key/value can be added if not found.
p_key$
Specifies the key to get a translationp_defaultValue!
Specifies the return value if the key is not found. By default, the key will be returned when not foundp_addIfNotFound
Specifies if the key with the defaultValue should be added when not found. 0=do not add, 1=addpublic BBjString getTranslation(BBjString p_key$, BBjString p_defaultValue!, BBjNumber p_addIfNotFound, BBjNumber p_forceAdd)
Returns the translated string given a key, if the translation is not found, then the passed in default value is returned. The key/value can be added forcefully or if not found.
p_key$
Specifies the key to get a translationp_defaultValue!
Specifies the return value if the key is not found. By default, the key will be returned when not foundp_addIfNotFound
Specifies if the key with the defaultValue should be added when not found. 0=do not add, 1=addp_forceAdd
Specifies if the key should be added when not found. 0=do not add, 1=addpublic BBjString getTranslation(BBjString p_key$, BBjString p_defaultValue!, BBjNumber p_addIfNotFound, BBjNumber p_forceAdd, BBjNumber p_skipParentLocale)
Returns the translated string given a key, if the translation is not found, then the passed in default value is returned. The key/value can be added forcefully or if not found. The parent locale translation can be optionally skipped.
p_key$
Specifies the key to get a translationp_defaultValue!
Specifies the return value if the key is not found. By default, the key will be returned when not foundp_addIfNotFound
Specifies if the key with the defaultValue should be added when not found. 0=do not add, 1=addp_forceAdd
Specifies if the key should be added when not found. 0=do not add, 1=addp_skipParentLocale
Specifies if the parent locale translations should be skipped. 0=skip, 1=do not skippublic BBjNumber isDefault()
Returns true if this is the default translations, otherwise false is returned
public void removeChild(Locale p_locale!)
Removes a child translation from the translations
p_locale!
Specifies the Java locale for the translationspublic void removeChildren()
Removes all children BBTranslationBundles
public void removeTranslation(BBjString p_key$)
Removes a translation given a key
p_key$
Specifies the key of the translation to removepublic void removeTranslations()
Removes all translations
public void setTranslation(BBjString p_key$, BBjString p_value$)
Sets a translation value
p_key$
Specifies the key of the translation to setp_value$
Specifies the value of the translation