public class BBTranslator extends Object
Modifier and Type | Field and Description |
---|---|
static BBjNumber |
BUFFER_SIZE
A field variable that defines the buffer size
|
BBjNumber |
Debug
A field variable that turns on and off debug capability
|
BBjString |
DebugFileName!
A field variable that contains the location of the debug file.
|
static BBjNumber |
MAX_FILE_SIZE
A field variable that defines the maximum file size
|
Modifier and Type | Method and Description |
---|---|
void |
clearCache()
Clears the namespace cache used by the BBTranslator
|
static Locale |
createLocale(BBjString p_localeString!)
Creates a java Locale object from the passed string
|
static Locale |
getClientLocale()
Returns the locale used by the client
|
static BBjString |
getClientLocaleString()
Returns the locale string used by the client
|
static BBTranslator |
getInstance(BBjString p_translationBundleName!)
Returns an instance of the BBTranslator given a translation bundle name
|
static BBTranslator |
getInstance(BBjString p_translationBundleName!,
BBjString p_locale!,
BBjString p_localeOfOrigin!,
BBjString p_translationBundleDir!)
Returns an instance of the BBTranslator given a translation bundle name, language, language of origin, and translation bundle directory
|
static BBTranslator |
getInstance(BBTranslationBundle p_translationBundle!,
Locale p_locale!)
Returns an instance of the BBTranslator so that there is only one instance per translation bundle and locale
|
BBjString |
getTranslation(BBjString p_key$)
Returns the translated string given a key
|
BBjString |
getTranslation(BBjString p_key$,
BBjString p_defaultValue!)
Returns the translated string given a key
|
BBjString |
getTranslation(BBjString p_key$,
BBjString p_defaultValue!,
BBjNumber p_addIfNotFound)
Returns the translated string given a key
|
BBjString |
getTranslation(BBjString p_key$,
BBjString p_defaultValue!,
BBjNumber p_addIfNotFound,
BBjNumber p_forceAdd)
Returns the translated string given a key
|
BBjString |
getTranslation(BBjString p_key$,
BBjString p_defaultValue!,
BBjNumber p_addIfNotFound,
BBjNumber p_forceAdd,
BBjNumber p_skipParentLocale)
Returns the translated string given a key
|
BBTranslationBundle |
getTranslationBundle()
Returns the translation Bundle
|
BBTranslations |
getTranslations()
Returns all translations for the current locale
|
public BBjNumber Debug
public BBjString DebugFileName!
public static BBjNumber MAX_FILE_SIZE
public static BBjNumber BUFFER_SIZE
public static BBTranslator getInstance(BBjString p_translationBundleName!)
p_translationBundleName!
- A string that specifies the name of the desired translation bundlepublic static BBTranslator getInstance(BBjString p_translationBundleName!, BBjString p_locale!, BBjString p_localeOfOrigin!, BBjString p_translationBundleDir!)
p_translationBundleName!
- A string that specifies the name of the desired translation bundlep_locale!
- A string that specifies the Java locale for the current translations in the format 'lang_COUNTRY_VARIANT', where COUNTRY and VARIANT are optionalp_localeOfOrigin!
- A string that specifies the locale string for the default translations in the format 'lang_COUNTRY_VARIANT', where COUNTRY and VARIANT are optionalp_translationBundleDir!
- A string that specifies the directory in which the translation bundle is locatedpublic static BBTranslator getInstance(BBTranslationBundle p_translationBundle!, Locale p_locale!)
p_translationBundle!
- A BBTranslationBundle object for the translator to usep_locale!
- A Java Locale object for the current translationspublic BBTranslationBundle getTranslationBundle()
public BBTranslations getTranslations()
public BBjString getTranslation(BBjString p_key$)
If the translation is not found, then the passed in key is returned
p_key$
- A string that specifies the key to translatepublic BBjString getTranslation(BBjString p_key$, BBjString p_defaultValue!)
If the translation is not found, then the passed in default value is returned
p_key$
- A string that specifies the key to translatep_defaultValue!
- A string that 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)
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$
- A string that specifies the key to translatep_defaultValue!
- A string that specifies the return value if the key is not found; by default the key will be returned when not foundp_addIfNotFound
- A number that specifies if the key should be added if not found. 0 = the key with the defaultValue should not be added if not found. 1 = the key with the defaultValue should be added when not found.public BBjString getTranslation(BBjString p_key$, BBjString p_defaultValue!, BBjNumber p_addIfNotFound, BBjNumber p_forceAdd)
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$
- A string that specifies the key to translatep_defaultValue!
- A string that specifies the return value if the key is not found; by default the key will be returned when not foundp_addIfNotFound
- A number that specifies if the key should be added if not found. 0 = the key with the defaultValue should not be added if not found. 1 = the key with the defaultValue should be added when not found.p_forceAdd
- A number that specifies if the key should be forcefully added if not found. 0 = the key with the defaultValue should not be added if not found. 1 = the key with the defaultValue should be added when not found.public BBjString getTranslation(BBjString p_key$, BBjString p_defaultValue!, BBjNumber p_addIfNotFound, BBjNumber p_forceAdd, BBjNumber p_skipParentLocale)
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 translations can be optionally skipped.
p_key$
- A string that specifies the key to translatep_defaultValue!
- A string that specifies the return value if the key is not found; by default the key will be returned when not foundp_addIfNotFound
- A number that specifies if the key should be added if not found. 0 = the key with the defaultValue should not be added if not found. 1 = the key with the defaultValue should be added when not found.p_forceAdd
- A number that specifies if the key should be forcefully added if not found. 0 = the key with the defaultValue should not be added if not found. 1 = the key with the defaultValue should be added when not found.p_skipParentLocale
- A number that specifies if the parent locale translations should be skipped. 0 = skip, 1 = do not skippublic static Locale createLocale(BBjString p_localeString!)
If the string is null then null is returned. The string should be in one of the following formats: LANGUAGE LANGUAGE_COUNTRY LANGUAGE_COUNTRY_VARIANT
p_localeString!
- A string that specifies local to createpublic static Locale getClientLocale()
public static BBjString getClientLocaleString()
public void clearCache()