Skip to content
This repository was archived by the owner on Oct 21, 2025. It is now read-only.

Commit 51cc791

Browse files
authored
Merge pull request #336 from openedx/dsheraz/push-translation-update
build: update push translation job
2 parents 671d98c + 4d1387f commit 51cc791

File tree

4 files changed

+28
-10
lines changed

4 files changed

+28
-10
lines changed

.babelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"i18n": {
1616
"plugins": [
1717
["react-intl", {
18-
"messagesDir": "./src/data/i18n/default/",
18+
"messagesDir": "./temp/babel-plugin-react-intl",
1919
"enforceDescriptions": true
2020
}]
2121
]

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
node_modules
44
npm-debug.log
55
coverage
6+
.idea
67

78
dist/
89
src/data/i18n/default/src/
10+
temp/babel-plugin-react-intl
11+
12+
## Emacs ###
13+
*~
14+
/temp
15+
/.vscode

.tx/config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ host = https://www.transifex.com
33

44
[o:open-edx:p:edx-platform:r:studio-frontend]
55
file_filter = src/data/i18n/locales/<lang>.json
6+
source_file = src/data/i18n/default/transifex_input.json
67
source_lang = en_US
78
type = KEYVALUEJSON
89

Makefile

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
UNAME := $(shell uname)
2+
3+
i18n = ./src/data/i18n/default
4+
transifex_input = $(i18n)/transifex_input.json
5+
6+
# This directory must match .babelrc .
7+
transifex_temp = ./temp/babel-plugin-react-intl
8+
29
export TRANSIFEX_RESOURCE = studio-frontend
310

411
# Help message borrowed from https://github.com/edx/devstack, which borrowed it from https://github.com/pydanny/cookiecutter-djangopackage.
@@ -28,6 +35,9 @@ down: ## stop and remove studio-frontend container
2835
stop: ## stops studio-frontend container
2936
docker-compose stop
3037

38+
requirements:
39+
npm install
40+
3141
npm-install-%: ## install specified % npm package on the studio-frontend container
3242
docker exec dahlia.studio-frontend npm install $* --save-dev
3343
git add package.json
@@ -55,27 +65,27 @@ asset-page-flag: ## insert a waffle flag into local docker devstack
5565
i18n.docker: ## what devs should do from their host machines
5666
docker exec -t dahlia.studio-frontend bash -c 'make i18n.extract && make i18n.preprocess'
5767

58-
extract_translations: ## no prerequisites so we can control order of operations
59-
echo "We have to define this target due to tooling assumptions"
60-
echo "Also we have to npm install using this hook b/c there's no other place for it in the current setup"
61-
npm install
62-
npm run-script i18n_extract
68+
extract_translations: | requirements i18n.extract i18n.preprocess
6369

6470
i18n.extract: ## move display strings from displayMessages.jsx to displayMessages.json
6571
npm run-script i18n_extract
6672

6773
i18n.preprocess: ## gather all display strings into a single file
68-
$$(npm bin)/reactifex ./src/data/i18n/default/src/components/ ./src/data/i18n/default/transifex_input.json
74+
$$(npm bin)/edx_reactifex $(transifex_temp) $(transifex_input)
6975

7076
i18n.pre_validate: | i18n.extract i18n.preprocess
7177
git diff --exit-code ./src/data/i18n/default/transifex_input.json
7278

7379
tx_url1 = https://www.transifex.com/api/2/project/edx-platform/resource/studio-frontend/translation/en/strings/
7480
tx_url2 = https://www.transifex.com/api/2/project/edx-platform/resource/studio-frontend/source/
75-
push_translations: | i18n.extract
76-
# Transifex is set up to watch transifex_input.json, but that filetype lacks comments
81+
# Pushes translations to Transifex. You must run make extract_translations first.
82+
push_translations:
83+
84+
# # Pushing strings to Transifex...
85+
tx push -s
86+
7787
./node_modules/@edx/reactifex/bash_scripts/get_hashed_strings_v3.sh
78-
$$(npm bin)/edx_reactifex ./src/data/i18n/default --comments --v3-scripts-path
88+
$$(npm bin)/edx_reactifex $(transifex_temp) --comments --v3-scripts-path
7989
./node_modules/@edx/reactifex/bash_scripts/put_comments_v3.sh
8090

8191
pull_translations: ## must be exactly this name for edx tooling support, see ecommerce-scripts/transifex/pull.py

0 commit comments

Comments
 (0)