Skip to content

Commit 8d5d26f

Browse files
authored
feat: extract translations for openedx-translations integration (#647)
allow MFEs and others to use this repo translations via openedx-translations github repository Refs: FC-0012 OEP-58
1 parent 9a7a019 commit 8d5d26f

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
.vscode
44
coverage
55
dist
6+
src/i18n/transifex_input.json
67
node_modules
78
/docs/api
89
.env.private
10+
/temp/

Makefile

+23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Documentation CLI usage: https://github.com/documentationjs/documentation/blob/master/docs/USAGE.md
22

3+
i18n = ./src/i18n
4+
transifex_input = $(i18n)/transifex_input.json
5+
transifex_utils = $(i18n)/scripts/transifex-utils.js
6+
7+
# This directory must match .babelrc .
8+
transifex_temp = ./temp/babel-plugin-formatjs
9+
310
doc_command = ./node_modules/.bin/documentation build src -g -c ./docs/documentation.config.yml -f md -o ./docs/_API-body.md --sort-order alpha
411
cat_docs_command = cat ./docs/_API-header.md ./docs/_API-body.md > ./docs/API.md
512

@@ -24,3 +31,19 @@ docs-watch:
2431

2532
docs-lint:
2633
./node_modules/.bin/documentation lint src
34+
35+
36+
.PHONY: requirements
37+
requirements: ## install ci requirements
38+
npm ci
39+
40+
i18n.extract:
41+
# Pulling display strings from .jsx files into .json files...
42+
rm -rf $(transifex_temp)
43+
npm run-script i18n_extract
44+
45+
i18n.concat:
46+
# Gathering JSON messages into one file...
47+
$(transifex_utils) $(transifex_temp) $(transifex_input)
48+
49+
extract_translations: | requirements i18n.extract i18n.concat

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"docs": "jsdoc -c jsdoc.json",
1313
"docs-watch": "nodemon -w src -w docs/template -w README.md -e js,jsx --exec npm run docs",
1414
"lint": "fedx-scripts eslint --ext .js --ext .jsx .",
15+
"i18n_extract": "fedx-scripts formatjs extract",
1516
"snapshot": "fedx-scripts jest --updateSnapshot",
1617
"start": "fedx-scripts webpack-dev-server --progress",
1718
"test": "fedx-scripts jest --coverage",

0 commit comments

Comments
 (0)