fcf.translate() function
Package: fcf-framework-core
File: fcf-framework-core:fcf.js
Available from version: 2.0.2
Performs tokenization only for translation constructs !{{...}}! and !{...}!.
Arguments
- The string or object to be tokenized. If an object is passed, then all values stored in it and in nested objects that are strings are tokenized.
- Translation language. If no translation is specified, then the language set in the execution context is used, or the default language if the language in the execution context is not specified.
Result
- Returns a tokenized string or raw object, depending on the passed parameter a_str
Example: Function application
fcf.getConfiguration().append({
translations: [
{
language: "ja",
translations: {
"Hello world": "こんにちは世界",
}
}
],
});
fcf.getContext().language = "ja"
let result = fcf.translate("Text: !{{Hello world}}!");
console.log(result);
Output:
Text: こんにちは世界