From 451eed829916627e9248f1003752b43617a20ff4 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 27 Jan 2021 15:55:27 -0300 Subject: mv build-aux/ -> aux/ and scripts/ --- scripts/apply-translations.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 scripts/apply-translations.sh (limited to 'scripts/apply-translations.sh') diff --git a/scripts/apply-translations.sh b/scripts/apply-translations.sh new file mode 100755 index 0000000..5920717 --- /dev/null +++ b/scripts/apply-translations.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu + +for f in $(git ls-files | grep -E '.(md|slides)$' | grep -Ev '^(vendor/reveal.js|TODOs.md|aux/)'); 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 . -type f -name '*.md' -exec grep -l "^ref: $ref$" {} \;) -type f -exec grep -l '^lang: en$' {} \;) + po2md "$FROM" --pofiles "locale/$l/LC_MESSAGES/${FROM%.md}.po" --quiet --save "$f" + fi +done -- cgit v1.2.3