Translations in CloudCode
The same translation files used in the application can be used in CloudCode, although the translation function itself is not provided currently.
yarn add js-yaml
const fs = require('fs');
const yaml = require('js-yaml');
export async function run() {
const language = 'en_US';
const doc = yaml.safeLoad(fs.readFileSync(`app/translations/${language}.yml`, 'utf8'));
console.log(doc);
}
The translation document can now be used inside the task.
For more information on how translations work for an app, please read the following documentation:
Last modified 7mo ago