aboutsummaryrefslogtreecommitdiff
path: root/scripts/apply-translations.sh
diff options
context:
space:
mode:
authornixpkgs-review <nixpkgs-review@example.com>2020-11-04 07:50:57 -0300
committernixpkgs-review <nixpkgs-review@example.com>2020-11-04 07:50:57 -0300
commit0e3d760826e209f3ae304ca0a7b12de300cd977e (patch)
treecdd0893838f308c71c73794189262f8fbb269217 /scripts/apply-translations.sh
parentTranslate most of the first TIL (diff)
downloadeuandre.org-0e3d760826e209f3ae304ca0a7b12de300cd977e.tar.gz
euandre.org-0e3d760826e209f3ae304ca0a7b12de300cd977e.tar.xz
Split sync-translations.sh into two scripts
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