diff options
author | EuAndreh <eu@euandre.org> | 2021-01-23 20:11:44 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2021-01-23 20:14:58 -0300 |
commit | 0f6839d4462a0ef539323e65cdfd8983dcf5d59c (patch) | |
tree | afbbdfc0555a2fbb7b0a2963ec13a07f29d23b3c /build-aux/extract-translations.sh | |
parent | Remove bundix-gen.sh (diff) | |
download | euandre.org-0f6839d4462a0ef539323e65cdfd8983dcf5d59c.tar.gz euandre.org-0f6839d4462a0ef539323e65cdfd8983dcf5d59c.tar.xz |
mv scripts/* build-aux/
Diffstat (limited to 'build-aux/extract-translations.sh')
-rwxr-xr-x | build-aux/extract-translations.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/build-aux/extract-translations.sh b/build-aux/extract-translations.sh new file mode 100755 index 0000000..2333865 --- /dev/null +++ b/build-aux/extract-translations.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -eu + +TRANSLATIONS='pt fr eo' + +for f in $(git ls-files | grep -E '.(md|slides)$' | grep -v '^vendor/reveal.js$'); do + file_lang="$(grep '^lang: ..$' "$f" | awk '{print $2}')" + if [ "$file_lang" = 'en' ]; then + for l in $TRANSLATIONS; do + OUT="locale/$l/LC_MESSAGES/${f%.md}.po" + mkdir -p "$(dirname "$OUT")" + md2po "$f" --include-codeblocks --quiet --save --po-filepath "$OUT" + done + fi +done |