aboutsummaryrefslogtreecommitdiff
path: root/scripts/extract-translations.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/extract-translations.sh')
-rwxr-xr-xscripts/extract-translations.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/extract-translations.sh b/scripts/extract-translations.sh
new file mode 100755
index 0000000..2333865
--- /dev/null
+++ b/scripts/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