|
| 1 | +transifex_resource = frontend-component-header |
| 2 | +transifex_langs = "ar,fr,es_419,zh_CN" |
| 3 | + |
| 4 | +transifex_utils = ./node_modules/.bin/transifex-utils.js |
| 5 | +i18n = ./src/i18n |
| 6 | +transifex_input = $(i18n)/transifex_input.json |
| 7 | +tx_url1 = https://www.transifex.com/api/2/project/edx-platform/resource/$(transifex_resource)/translation/en/strings/ |
| 8 | +tx_url2 = https://www.transifex.com/api/2/project/edx-platform/resource/$(transifex_resource)/source/ |
| 9 | + |
| 10 | +# This directory must match .babelrc . |
| 11 | +transifex_temp = ./temp/babel-plugin-react-intl |
| 12 | + |
1 | 13 | build: |
2 | 14 | rm -rf ./dist |
3 | 15 | ./node_modules/.bin/babel src --out-dir dist --source-maps --ignore **/*.test.jsx,**/__mocks__,**/__snapshots__,**/setupTest.js --copy-files |
4 | | - # --copy-files will bring in everything else that wasn't processed by babel. Remove what we don't want. |
5 | | - rm -rf dist/**/*.test.jsx |
6 | | - rm -rf dist/**/__snapshots__ |
7 | | - rm -rf dist/__mocks__ |
| 16 | + @# --copy-files will bring in everything else that wasn't processed by babel. Remove what we don't want. |
| 17 | + @rm -rf dist/**/*.test.jsx |
| 18 | + @rm -rf dist/**/__snapshots__ |
| 19 | + @rm -rf dist/__mocks__ |
| 20 | + |
| 21 | +requirements: |
| 22 | + npm install |
| 23 | + |
| 24 | +i18n.extract: |
| 25 | + # Pulling display strings from .jsx files into .json files... |
| 26 | + rm -rf $(transifex_temp) |
| 27 | + npm run-script i18n_extract |
| 28 | + |
| 29 | +i18n.concat: |
| 30 | + # Gathering JSON messages into one file... |
| 31 | + $(transifex_utils) $(transifex_temp) $(transifex_input) |
| 32 | + |
| 33 | +extract_translations: | requirements i18n.extract i18n.concat |
| 34 | + |
| 35 | +# Despite the name, we actually need this target to detect changes in the incoming translated message files as well. |
| 36 | +detect_changed_source_translations: |
| 37 | + # Checking for changed translations... |
| 38 | + git diff --exit-code $(i18n) |
| 39 | + |
| 40 | +# Pushes translations to Transifex. You must run make extract_translations first. |
| 41 | +push_translations: |
| 42 | + # Pushing strings to Transifex... |
| 43 | + tx push -s |
| 44 | + # Fetching hashes from Transifex... |
| 45 | + ./node_modules/reactifex/bash_scripts/get_hashed_strings.sh $(tx_url1) |
| 46 | + # Writing out comments to file... |
| 47 | + $(transifex_utils) $(transifex_temp) --comments |
| 48 | + # Pushing comments to Transifex... |
| 49 | + ./node_modules/reactifex/bash_scripts/put_comments.sh $(tx_url2) |
| 50 | + |
| 51 | +# Pulls translations from Transifex. |
| 52 | +pull_translations: |
| 53 | + tx pull -f --mode reviewed --language=$(transifex_langs) |
| 54 | + |
| 55 | +# This target is used by Travis. |
| 56 | +validate-no-uncommitted-package-lock-changes: |
| 57 | + # Checking for package-lock.json changes... |
| 58 | + git diff --exit-code package-lock.json |
0 commit comments