aboutsummaryrefslogtreecommitdiff
path: root/scripts/apply-translations.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xscripts/apply-translations.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/apply-translations.sh b/scripts/apply-translations.sh
new file mode 100755
index 0000000..2620638
--- /dev/null
+++ b/scripts/apply-translations.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+cd "$(dirname "${BASH_SOURCE[0]}")"
+cd ../
+
+for f in $(find _tils -type f -name '*.md' | grep -v '^./vendor/' | grep -v '^./_site/' | grep -v './drafts/' | grep -v './templates/'); do
+ l="$(grep '^lang: ..$' "$f" | awk '{print $2}')"
+ if [[ "$l" != 'en' ]]; then
+ ref="$(grep '^ref: ' "$f" | awk '{print $2}')"
+ # shellcheck disable=2046
+ FROM=$(find $(find . -name '*.md' -exec grep -l "^ref: $ref$" {} \;) -exec grep -l '^lang: en$' {} \;)
+ po2md "$FROM" --pofiles "locale/$l/LC_MESSAGES/${FROM%.md}.po" --quiet --save "$f"
+ fi
+done