commit d786453c6b4e6ce67f41ff3b25d4e51059333491
parent c331541807ac01908336142326b475c472f19b0d
Author: ms <ms@taler.net>
Date: Mon, 3 Jan 2022 09:26:10 +0100
fix i18n extractor (#7140)
Diffstat:
2 files changed, 32 insertions(+), 20 deletions(-)
diff --git a/build-translations.sh b/build-translations.sh
@@ -1,25 +1,35 @@
#!/bin/bash
-cd packages/frontend;
-PONAME=taler-merchant-backoffice
-POGEN=node_modules/@gnu-taler/pogen/bin/pogen.js
+set -eu
-find src \( -name '*.ts' -or -name '*.tsx' \) ! -name '*.d.ts' \
- | xargs node $POGEN \
- | msguniq \
- | msgmerge src/i18n/poheader - \
- > src/i18n/$PONAME.pot
+function build {
+ POTGEN=node_modules/@gnu-taler/pogen/bin/pogen
+ PACKAGE_NAME=$1
-# merge existing translations
-for pofile in src/i18n/*.po; do
- echo merging $pofile;
- msgmerge -o $pofile $pofile src/i18n/$PONAME.pot;
-done;
-
-# generate .ts file containing all translations
-cat src/i18n/strings-prelude > src/i18n/strings.ts
-for pofile in src/i18n/*.po; do \
- echo appending $pofile; \
- ./contrib/po2ts $pofile >> src/i18n/strings.ts; \
-done;
+ find \( -type d -name '*.ts' -or -name '*.tsx' \) ! -name '*.d.ts' \
+ | xargs node $POTGEN \
+ | msguniq \
+ | msgmerge src/i18n/poheader - \
+ > src/i18n/$PACKAGE_NAME.pot
+
+ # merge existing translations: fails when NO .po-files were found.
+ for pofile in $(ls src/i18n/*.po 2> /dev/null || true); do
+ echo merging $pofile;
+ msgmerge -o $pofile $pofile src/i18n/$PACKAGE_NAME.pot;
+ done;
+
+ # generate .ts file containing all translations
+ cat src/i18n/strings-prelude > src/i18n/strings.ts
+ for pofile in $(ls src/i18n/*.po 2> /dev/null || true); do \
+ echo appending $pofile; \
+ ./contrib/po2ts $pofile >> src/i18n/strings.ts; \
+ done;
+}
+for package in $(ls packages); do
+ echo "Building $package.."
+ cd packages/$package
+ build package
+ echo "DONE"
+ cd -
+done
diff --git a/packages/bank/package.json b/packages/bank/package.json
@@ -53,6 +53,7 @@
"@typescript-eslint/parser": "^5.3.0",
"jest-fetch-mock": "^3.0.3",
"bulma": "^0.9.3",
+ "@gnu-taler/pogen": "^0.0.5",
"bulma-checkbox": "^1.1.1",
"bulma-radio": "^1.1.1",
"enzyme": "^3.11.0",
@@ -61,6 +62,7 @@
"eslint-config-preact": "^1.2.0",
"jest": "^27.3.1",
"jest-preset-preact": "^4.0.5",
+ "po2json": "^0.4.5",
"jssha": "^3.2.0",
"preact-cli": "3.0.5",
"sass": "1.32.13",