diff options
author | nixpkgs-review <nixpkgs-review@example.com> | 2020-11-04 07:50:57 -0300 |
---|---|---|
committer | nixpkgs-review <nixpkgs-review@example.com> | 2020-11-04 07:50:57 -0300 |
commit | 0e3d760826e209f3ae304ca0a7b12de300cd977e (patch) | |
tree | cdd0893838f308c71c73794189262f8fbb269217 /scripts/extract-translations.sh | |
parent | Translate most of the first TIL (diff) | |
download | euandre.org-0e3d760826e209f3ae304ca0a7b12de300cd977e.tar.gz euandre.org-0e3d760826e209f3ae304ca0a7b12de300cd977e.tar.xz |
Split sync-translations.sh into two scripts
Diffstat (limited to '')
-rwxr-xr-x | scripts/extract-translations.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/extract-translations.sh b/scripts/extract-translations.sh new file mode 100755 index 0000000..e6d2071 --- /dev/null +++ b/scripts/extract-translations.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -Eeuo pipefail +cd "$(dirname "${BASH_SOURCE[0]}")" +cd ../ + +TRANSLATIONS=(pt fr eo) + +for f in $(find . -type f -name '*.md' | grep -v '^./vendor' | grep -v '^./_site' | grep -v '^./drafts/' | grep -v './templates/'); 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" --quiet --save --po-filepath "$OUT" + done + fi +done |