fcf.appendTranslate() function
Package: fcf-framework-core
File: fcf-framework-core:fcf.js
Available from version: 2.0.2
Adds translations. If necessary, it can cause a complete reloading of all translation files.
Object format
If the argument is given by an object, then the object must contain two fields
-
string language - Translation language -
object translations - Object with translations. The key is the string to be translated, and the value is the translation.
Example:
fcf.appendTranslate({
language: "ja",
translations: {
"Hello world": "こんにちは世界",
}
});
File path format with translations
Translations can be supplied from a JSON file. Then the argument must contain the path to the file in FCF notation.
The format of the translation file may be in the format of a translation object as described previously, or may be an array containing objects with information about translations.
:translations/translations.json file
{
language: "ja",
translations: {
"Hello world": "こんにちは世界",
}
}
Execution example:
fcf.appendTranslate(":translations/translations.json");
Array fromat
The argument can be passed as an array, the elements of which must either be objects describing translations, or be strings containing paths to files.