BBTranslationBundle
Description
In BBj 9.0 and higher, the BBTranslationBundle utility is a BBj CustomObject used to get and add translations with backend Java properties files for localization support.
Creation
The BBTranslationBundle class can be found in <bbj install>/utils/translations/bbtranslator.bbj.
BBTranslationBundle.getBundle(string name) |
BBTranslationBundle.getBundle(string name, string directory) |
BBTranslationBundle.getBundle(string name, string directory, locale localeOfOrigin) |
Parameters
Parameter |
Description |
name |
Specifies the name of the translation bundle. |
translationBundle |
Specifies the translation bundle the translator will use. |
localeOfOrigin |
Specifies the Java locale for the default translations. |
Methods of BBTranslationBundle
Return Value |
Method |
void |
addLocale(Locale locale) |
void |
addTranslation(string key, string value) |
void |
addTranslation(string key, HashMap values) |
void |
addTranslation(Locale locale, string key, string value) |
void |
|
static void |
compareBundles(string bundleName, string bundleDir1, string bundleDir2, boolean displayToConsole) |
string |
|
Locale |
|
string |
getName() |
string |
getTranslation(string key) |
string |
getTranslation(string key, string defaultValue) |
string |
getTranslation(string key, string defaultValue, boolean addIfNotFound) |
string |
getTranslation(Locale locale, string key) |
string |
getTranslation(Locale locale, string key, string defaultValue) |
string |
getTranslation(Locale locale, string key, string defaultValue, boolean addIfNotFound) |
getTranslations(Locale locale) |
|
void |
removeLocale(Locale locale) |
void |
save() |
void |
save(string directoryName) |
static void |
writePropertiesFile(string propertiesFileName, Properties properties) |
static void |
validateBundle(string bundleName, string bundleDirName) |
static void |
validateBundle(string bundleName, string bundleDirName, string reportName) |
static void |
validateBundle(string bundleName, string bundleDirName, string reportName, boolean removeInvalid) |
Remarks
None.
Constants
Name |
Value |
NAME_ERROR |
256 |
REMOVE_LOCALE_ERROR |
257 |
DIR_ERROR |
258 |
SAVE_ERROR |
259 |
Example
|