new translations.dt/js/api/EditableTranslatable(i18nKeyopt, valueopt, autoEscapeopt)
stable API
Constructs an EditableTranslatable. Calling the constructor with no arguments will create an empty-string translatable.
To avoid using this constructor directly (to not have have a DT dependency for example) use the factory method I18n.createTranslatable() .
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
i18nKey |
String |
<optional> |
the i18n key of the translatable |
|
value |
String |
<optional> |
the value of the translatable |
|
autoEscape |
Boolean |
<optional> |
true | whether special chars ${}[] should be treated as string literals by default |
- Version:
- 16.3.1
- Source:
- See:
Extends
- translations/js/api/Translatable
Methods
delete() → {EditableTranslatable}
stable API
Deletes the string value stored for this translation key.
- Version:
- 16.3.1
- Source:
Returns:
this, to allow for chained calls
- Type
- EditableTranslatable
store(value) → {EditableTranslatable}
stable API
Stores a new string value for this Translatable. The value must be a non-empty string.
Parameters:
Name | Type | Description |
---|---|---|
value |
String | the value to be stored for the translation key |
- Version:
- 16.3.1
- Source:
Throws:
-
if the value is undefined, null, empty string, or not a string
- Type
- Error
Returns:
this, to allow for chained calls
- Type
- EditableTranslatable
toTranslatableString() → {String}
stable API
Generates a string to be used to represent the translatable in the generated DOM. This method would typically be called during view generation. It would return
- A language-independent JS expression that will get bound at run-time
- the empty string '' if there is no value stored for the translatable's i18n key
- Version:
- 16.3.1
- Source:
Returns:
a String to be used to represent the Translatable
- Type
- String