From 0f6839d4462a0ef539323e65cdfd8983dcf5d59c Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 23 Jan 2021 20:11:44 -0300 Subject: mv scripts/* build-aux/ --- build-aux/apply-translations.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 build-aux/apply-translations.sh (limited to 'build-aux/apply-translations.sh') diff --git a/build-aux/apply-translations.sh b/build-aux/apply-translations.sh new file mode 100755 index 0000000..e1b92db --- /dev/null +++ b/build-aux/apply-translations.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu + +for f in $(git ls-files | grep -E '.(md|slides)$' | grep -v '^vendor/reveal.js$'); 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 -- cgit v1.2.3