|
| 1 | +transifex_resource = frontend-template-application |
| 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 | + |
| 13 | +precommit: |
| 14 | + npm run lint |
| 15 | + npm audit |
| 16 | + |
| 17 | +requirements: |
| 18 | + npm install |
| 19 | + |
| 20 | +i18n.extract: |
| 21 | + # Pulling display strings from .jsx files into .json files... |
| 22 | + rm -rf $(transifex_temp) |
| 23 | + npm run-script i18n_extract |
| 24 | + |
| 25 | +i18n.concat: |
| 26 | + # Gathering JSON messages into one file... |
| 27 | + $(transifex_utils) $(transifex_temp) $(transifex_input) |
| 28 | + |
| 29 | +extract_translations: | requirements i18n.extract i18n.concat |
| 30 | + |
| 31 | +# Despite the name, we actually need this target to detect changes in the incoming translated message files as well. |
| 32 | +detect_changed_source_translations: |
| 33 | + # Checking for changed translations... |
| 34 | + git diff --exit-code $(i18n) |
| 35 | + |
| 36 | +# Pushes translations to Transifex. You must run make extract_translations first. |
| 37 | +push_translations: |
| 38 | + # Pushing strings to Transifex... |
| 39 | + tx push -s |
| 40 | + # Fetching hashes from Transifex... |
| 41 | + ./node_modules/reactifex/bash_scripts/get_hashed_strings.sh $(tx_url1) |
| 42 | + # Writing out comments to file... |
| 43 | + $(transifex_utils) $(transifex_temp) --comments |
| 44 | + # Pushing comments to Transifex... |
| 45 | + ./node_modules/reactifex/bash_scripts/put_comments.sh $(tx_url2) |
| 46 | + |
| 47 | +# Pulls translations from Transifex. |
| 48 | +pull_translations: |
| 49 | + tx pull -f --mode reviewed --language=$(transifex_langs) |
| 50 | + |
| 51 | +# This target is used by Travis. |
| 52 | +validate-no-uncommitted-package-lock-changes: |
| 53 | + # Checking for package-lock.json changes... |
| 54 | + git diff --exit-code package-lock.json |
0 commit comments