Skip to content

Commit

Permalink
build: update i18n scripts (#1396)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamstankiewicz authored Jun 18, 2022
1 parent d99f111 commit 3ce568a
Show file tree
Hide file tree
Showing 22 changed files with 653 additions and 663 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ coverage
jest*
dist
src/i18n/transifex_input.json
src/i18n/temp

# gatsby files
www/.cache/
Expand Down
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 = STRUCTURED_JSON
type = KEYVALUEJSON
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
build:
rm -rf ./dist
./node_modules/.bin/babel src --out-dir dist --source-maps --ignore **/*.test.jsx,**/__mocks__,**/__snapshots__,**/setupTest.js --copy-files
./node_modules/.bin/babel src --config-file ./babel.config.json --out-dir dist --source-maps --ignore **/*.test.jsx,**/__mocks__,**/__snapshots__,**/setupTest.js --copy-files
# --copy-files will bring in everything else that wasn't processed by babel. Remove what we don't want.
rm -rf dist/**/*.test.jsx
rm -rf dist/**/__snapshots__
rm -rf dist/__mocks__
rm -rf dist/setupTest.js
node build-scss.js

transifex_resource = paragon
tx_url1 = https://www.transifex.com/api/2/project/edx-platform/resource/$(transifex_resource)/translation/en/strings/
tx_url2 = https://www.transifex.com/api/2/project/edx-platform/resource/$(transifex_resource)/source/
transifex_langs = "ar,ca,es_419,fr,he,id,ko_KR,pl,pt_BR,ru,th,uk,zh_CN"
i18n = ./src/i18n
transifex_input = $(i18n)/transifex_input.json
Expand All @@ -30,7 +33,11 @@ i18n.extract:
# Pulling display strings from .jsx files into .json files...
npm run-script i18n_extract

extract_translations: | requirements i18n.extract
i18n.extract_comments:
# Pulling comments from display strings in .jsx files into .json files...
npm run-script i18n_extract_comments

extract_translations: | requirements i18n.extract i18n.extract_comments

# Despite the name, we actually need this target to detect changes in the incoming translated message files as well.
detect_changed_source_translations:
Expand All @@ -41,6 +48,10 @@ detect_changed_source_translations:
push_translations:
# Pushing strings to Transifex...
tx push -s
# Pushing comments...
./node_modules/@edx/reactifex/bash_scripts/get_hashed_strings.sh $(tx_url1)
$(i18n)/transifex_utils.js $(i18n)/temp
./node_modules/@edx/reactifex/bash_scripts/put_comments.sh $(tx_url2)

# Pulls translations from Transifex.
pull_translations:
Expand Down
2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ coverage:
default:
target: auto
threshold: 1%
ignore:
- "src/i18n"
Loading

0 comments on commit 3ce568a

Please sign in to comment.