From 140288890899a167da8c9d71b56d6c0c83b9062b Mon Sep 17 00:00:00 2001 From: Viktor Rusakov <52399399+viktorrusakov@users.noreply.github.com> Date: Wed, 22 Jun 2022 16:52:09 +0300 Subject: [PATCH] build: update i18n script to compile messages pulled from transifex (#1405) --- .tx/config | 2 +- Makefile | 11 ++++------- package.json | 3 ++- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.tx/config b/.tx/config index 3d393487c7..2b68c0d3d7 100644 --- a/.tx/config +++ b/.tx/config @@ -5,4 +5,4 @@ host = https://www.transifex.com file_filter = src/i18n/messages/.json source_file = src/i18n/transifex_input.json source_lang = en -type = KEYVALUEJSON +type = STRUCTURED_JSON diff --git a/Makefile b/Makefile index 09c797b677..0a8a2038e4 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ build: node build-scss.js export TRANSIFEX_RESOURCE = paragon -transifex_langs = "ar,ca,es_419,fr,he,id,ko_KR,pl,pt_BR,ru,th,uk,zh_CN +transifex_langs = "ar,ca,es_419,fr,he,id,ko_KR,pl,pt_BR,ru,th,uk,zh_CN" i18n = ./src/i18n transifex_utils = $(i18n)/transifex-utils.js transifex_input = $(i18n)/transifex_input.json @@ -55,14 +55,11 @@ push_translations: # Pushing strings to Transifex, temporarily with force... tx push -s -f - # Pushing comments to Transifex... - ./node_modules/@edx/reactifex/bash_scripts/get_hashed_strings_v3.sh - $(transifex_utils) $(transifex_temp) - ./node_modules/@edx/reactifex/bash_scripts/put_comments_v3.sh - # Pulls translations from Transifex. pull_translations: - tx pull -f --mode reviewed --languages=$(transifex_langs) + tx pull -f --mode onlyreviewed --languages=$(transifex_langs) + # compile files with translated strings to KEYVALUEJSON format which react-intl understands... + npm run-script i18n_compile # This target is used by Travis. validate-no-uncommitted-package-lock-changes: diff --git a/package.json b/package.json index 5567389c08..34ac8826f7 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,8 @@ "generate-component": "cd component-generator && npm start", "generate-component-lint": "cd component-generator && npm run lint", "generate-changelog": "node generate-changelog.js", - "i18n_extract": "formatjs extract 'src/**/*.jsx' --out-file ./src/i18n/transifex_input.json --format simple", + "i18n_compile": "formatjs compile-folder --format transifex ./src/i18n/messages ./src/i18n/messages", + "i18n_extract": "formatjs extract 'src/**/*.jsx' --out-file ./src/i18n/transifex_input.json --format transifex", "i18n_extract_comments": "formatjs extract 'src/**/*.jsx' --out-file ./src/i18n/temp/reactifex_input.json --format ./src/i18n/reactifexFormatter" }, "dependencies": {