diff options
author | Florian Dold <florian@dold.me> | 2022-10-24 10:46:14 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-10-24 10:46:14 +0200 |
commit | 3e060b80428943c6562250a6ff77eff10a0259b7 (patch) | |
tree | d08472bc5ca28621c62ac45b229207d8215a9ea7 /packages/demobank-ui/build-bank-translations.sh | |
parent | fb52ced35ac872349b0e1062532313662552ff6c (diff) |
repo: integrate packages from former merchant-backoffice.git
Diffstat (limited to 'packages/demobank-ui/build-bank-translations.sh')
-rwxr-xr-x | packages/demobank-ui/build-bank-translations.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/packages/demobank-ui/build-bank-translations.sh b/packages/demobank-ui/build-bank-translations.sh new file mode 100755 index 000000000..85c8ad0c1 --- /dev/null +++ b/packages/demobank-ui/build-bank-translations.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +set -eu + +# NOTE: the <Translate> node somehow didn't get +# the strings extracted. Only i18n`` did + +function build { + POTGEN=node_modules/@gnu-taler/pogen/bin/pogen + PACKAGE_NAME=$1 + + find src/ \( -type f -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; +} + +build bank |