Skip to content

Commit

Permalink
feat: extract translations for openedx-translations integration (open…
Browse files Browse the repository at this point in the history
…edx#647)

allow MFEs and others to use this repo translations via
openedx-translations github repository

Refs: FC-0012 OEP-58
  • Loading branch information
OmarIthawi authored and bra-i-am committed May 14, 2024
1 parent bbb515b commit 0f0ff56
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
.vscode
coverage
dist
src/i18n/transifex_input.json
node_modules
/docs/api
.env.private
/temp/
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Documentation CLI usage: https://github.com/documentationjs/documentation/blob/master/docs/USAGE.md

i18n = ./src/i18n
transifex_input = $(i18n)/transifex_input.json
transifex_utils = $(i18n)/scripts/transifex-utils.js

# This directory must match .babelrc .
transifex_temp = ./temp/babel-plugin-formatjs

doc_command = ./node_modules/.bin/documentation build src -g -c ./docs/documentation.config.yml -f md -o ./docs/_API-body.md --sort-order alpha
cat_docs_command = cat ./docs/_API-header.md ./docs/_API-body.md > ./docs/API.md

Expand All @@ -24,3 +31,19 @@ docs-watch:

docs-lint:
./node_modules/.bin/documentation lint src


.PHONY: requirements
requirements: ## install ci requirements
npm ci

i18n.extract:
# 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...
$(transifex_utils) $(transifex_temp) $(transifex_input)

extract_translations: | requirements i18n.extract i18n.concat
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"docs": "jsdoc -c jsdoc.json",
"docs-watch": "nodemon -w src -w docs/template -w README.md -e js,jsx --exec npm run docs",
"lint": "fedx-scripts eslint --ext .js --ext .jsx .",
"i18n_extract": "fedx-scripts formatjs extract",
"snapshot": "fedx-scripts jest --updateSnapshot",
"start": "fedx-scripts webpack-dev-server --progress",
"test": "fedx-scripts jest --coverage",
Expand Down

0 comments on commit 0f0ff56

Please sign in to comment.