JavaScript Application Development API for Oracle Visual Builder Cloud Service - Classic Applications

Class: module:translations/js/api/I18n

Static routines for common translation tasks.

Version:
  • 16.3.1
Source:

Members

Methods

(static) createTranslatable(i18nKey) → {translations/js/api/Translatable}

stable API

A factory method for instantiating Translatable. The i18n key passed into this method can be:

  1. The key of a currently existing translation, run-time or design-time
  2. A newly minted key for a non-existing translation; use I18n.key() to construct such keys
  3. The empty string. Creating empty-string translatables can be used to intialize fields with a Translatable whose value can be entered later
Parameters:
Name Type Description
i18nKey String

the key for the new translatable

Version:
  • 16.3.1
Source:
Returns:

the created translatable or undefined if the passed-in key was invalid

Type
translations/js/api/Translatable
Examples

Create a Translatable From a DT String

var displayNameNls = I18n.createTranslatable('componentsDt.createButtonDisplayText');

Create a Translatable From a Newly-Minted Key

var fieldNameNls = I18n.createTranslatable(I18n.key(I18n.Type.Entity, entity.getId(), field.getId(), I18n.Suffix.SingularName));

Create an Empty-String Translatable

var displayNameNls = I18n.createTranslatable('');

Create a Translatable From a Previously Serialized Translatable

// Reading a previously persisted translatable
var serializedDisplayName = model.data.displayName;
// De-serializing a translatable
var displayNameNls = I18n.createTranslatable(serializedDisplayName);