Skip to content

Commit

Permalink
fix: upgrade frontend-i18n library
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjoy committed Jun 7, 2019
1 parent 6db2d70 commit e9c2816
Show file tree
Hide file tree
Showing 15 changed files with 5,566 additions and 5,500 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"i18n": {
"plugins": [
["react-intl", {
"messagesDir": "./temp",
"messagesDir": "./temp/babel-plugin-react-intl",
"moduleSourceName": "@edx/frontend-i18n"
}]
]
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ temp
.idea/

src/i18n/transifex_input.json
temp/babel-plugin-react-intl
51 changes: 28 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,41 +1,46 @@
transifex_resource = frontend-component-footer
transifex_langs = "ar,fr,es_419,zh_CN"
transifex_utils = ./node_modules/.bin/transifex-utils.js
transifex_input = ./src/i18n/transifex_input.json
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/

# this directory must match .babelrc
transifex_temp = ./temp/babel-plugin-react-intl

requirements:
npm install

i18n.extract:
# Pulling display strings from .jsx files into .json files...
# Pulling display strings from .jsx files into .json files...
rm -rf $(transifex_temp)
npm run-script i18n_extract

i18n.concat:
# Gathering JSON messages into one file...
./src/i18n/i18n-concat.js ./temp/src ./src/i18n/transifex_input.json


# The following make targets are required by our tooling scripts found in:
# - https://github.com/edx/ecommerce-scripts/tree/master/transifex
# Gathering JSON messages into one file...
$(transifex_utils) $(transifex_temp) $(transifex_input)

extract_translations: | requirements i18n.extract i18n.concat

detect_changed_source_translations:
git diff --exit-code ./src/i18n/transifex_input.json
# Checking for changed translations...
git diff --exit-code $(transifex_input)

tx_url1 = https://www.transifex.com/api/2/project/edx-platform/resource/frontend-component-footer/translation/en/strings/
tx_url2 = https://www.transifex.com/api/2/project/edx-platform/resource/frontend-component-footer/source/
validate-no-uncommitted-package-lock-changes:
# Checking for package-lock.json changes...
git diff --exit-code package-lock.json

# push translations to Transifex, doing magic so we can include the translator comments
# Note: extract_translations is a prereq that our translation script calls separately.
# Push translations to Transifex. Run make extract_translations first.
push_translations:
# Pushing strings to Transifex...
tx push -s
# Adding translator comments...
# Fetching strings from Transifex...
# Fetching hashes from Transifex...
./node_modules/reactifex/bash_scripts/get_hashed_strings.sh $(tx_url1)
# Writing out comments to file...
./src/i18n/i18n-concat.js ./temp/src --comments
# Adding comments to Transifex...
# Writing out comments to file...
$(transifex_utils) $(transifex_temp) --comments
# Pushing comments to Transifex...
./node_modules/reactifex/bash_scripts/put_comments.sh $(tx_url2)

# pull translations from Transifex
pull_translations: ## must be exactly this name for edx tooling support, see ecommerce-scripts/transifex/pull.py
tx pull -f --mode reviewed --language="ar,fr,es_419,zh_CN"

validate-no-uncommitted-package-lock-changes:
git diff --exit-code package-lock.json
# Pull translations from Transifex
pull_translations:
tx pull -f --mode reviewed --language=$(transifex_langs)
Loading

0 comments on commit e9c2816

Please # to comment.