Skip to content

Commit

Permalink
build: update i18n script to compile messages pulled from transifex (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorrusakov authored Jun 22, 2022
1 parent 888f356 commit 1402888
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ host = https://www.transifex.com
file_filter = src/i18n/messages/<lang>.json
source_file = src/i18n/transifex_input.json
source_lang = en
type = KEYVALUEJSON
type = STRUCTURED_JSON
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 1402888

Please sign in to comment.