Namespace: i18n

bcdui. i18n

Members

staticbcdui.i18n.TAG

A magic i18n token, which can prefix a string literal to tag it as an i18n-key rather than plain-text. This is an incubating feature only.

Methods

staticbcdui.i18n.formatMessage(message, values, formattingFunctions)

i18n/i18nPackage.js, line 264
formats message
Name Type Description
message string
values Array.<any> Array values to set
formattingFunctions object
Example
bcdui.i18n.formatMessage( "Successfully updated {0} records in {1,number,#0.00} columns.", [ 3, 2 ] );

staticbcdui.i18n.getValue(key, defaultValue){string}

i18n/i18nPackage.js, line 422
synchronously translates i18n key, please always use bcdTranslate attribute on html for i18n whenever possible. bcdui.is18n.isReady() must be true prior calling this, otherwise catalog is not loaded yet. You can wrap your main init function into bcdui.core.ready() to ensure core resources are initialized prior executing your code.
Name Type Description
key string the key to translate
defaultValue string to return in case no translation was found or the i18n model is not ready yet
Returns:
Type Description
string translated or default value

staticbcdui.i18n.isReady(){boolean}

i18n/i18nPackage.js, line 242
Returns:
Type Description
boolean true, when i18n catalog is loaded and ready to use

staticbcdui.i18n.switchLanguage(lang)

i18n/i18nPackage.js, line 432
reloads entire page in a given language this function requires the mapped SubjectPreferences servlet and a subjectPreferences.xml holding an entry for
Name Type Description
lang string the language code

staticbcdui.i18n.syncTranslateFormatMessage(messageId){string}

i18n/i18nPackage.js, line 397
Assumes bcdui.wkModels.bcdI18nModel is ready and synchronously translates and formats the given message id.
Name Type Description
messageId SyncTranslateFormatMessageParam | string Either an object with property msgid, or the messageId itself
Returns:
Type Description
string translated and formated message

staticbcdui.i18n.syncTranslateHTMLElement(args)

i18n/i18nPackage.js, line 206
Translates the given over HTML element or the whole document without waiting for i18nModel, we rely on it being loaded and executed before. If the catalog is not initialized up to this moment (the catalog initialization is asynchronous) then translation is optionally scheduled to a point when the catalog is loaded.
Name Type Description
args Object Parameter object
Name Type Default Description
targetHtml targetHtmlRef An existing HTML element this widget should be attached to, provide a dom element, a jQuery element or selector, or an element id. This is prefered over args.elementOrId
elementOrId HtmlElement | string ID or HTML element to translate, default "document"
catalog Object Catalog with i18n entries
doDefer boolean true If true, in case at time of syncTranslateHtmlElement the catalog is not loaded yet, the translation is deferred and re-executed once catalog is loaded

staticbcdui.i18n.translateHTMLElement(args){void}

i18n/i18nPackage.js, line 162
Translates HTML element and its children according to i18n model values, the method is asynchronous and "schedules" the translation
Name Type Description
args Object Parameter object
Name Type Description
targetHtml targetHtmlRef An existing HTML element this widget should be attached to, provide a dom element, a jQuery element or selector, or an element id. This is prefered over args.elementOrId
elementOrId HtmlElement | string ID or HTML element to translate, default "document"
i18nModelId string model with i18n entries, default "bcdI18nModel"
display string original css 'display' value of the HTML element to be set after translation
Returns:
Type Description
void