From 10031aaeb2616abc3c6df11c9f37a41e96a9df2b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 3 Nov 2020 17:14:34 -0300 Subject: Rename: scripts/assert-translations.sh -> scripts/sync-translations.sh --- scripts/assert-translations.sh | 26 -------------------------- scripts/sync-translations.sh | 26 ++++++++++++++++++++++++++ tests.sh | 2 +- 3 files changed, 27 insertions(+), 27 deletions(-) delete mode 100755 scripts/assert-translations.sh create mode 100755 scripts/sync-translations.sh diff --git a/scripts/assert-translations.sh b/scripts/assert-translations.sh deleted file mode 100755 index e12d968..0000000 --- a/scripts/assert-translations.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/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 '^./drafts/'); 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 - -for f in $(find . -type f -name '*.md' | grep -v '^./vendor/' | grep -v '^./_site/' | grep './drafts/'); do - l="$(grep '^lang: ..$' "$f" | awk '{print $2}')" - if [[ "$l" != 'en' ]]; then - ref="$(grep '^ref: ' "$f" | awk '{print $2}')" - FROM=$(find $(find . -name '*.md' -exec grep -l "^ref: $ref$" {} \;) -exec grep -l '^lang: en$' {} \;) - po2md "$FROM" --pofiles "locale/$l/LC_MESSAGES/$ref.po" --quiet --save "$f" - fi -done diff --git a/scripts/sync-translations.sh b/scripts/sync-translations.sh new file mode 100755 index 0000000..e12d968 --- /dev/null +++ b/scripts/sync-translations.sh @@ -0,0 +1,26 @@ +#!/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 '^./drafts/'); 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 + +for f in $(find . -type f -name '*.md' | grep -v '^./vendor/' | grep -v '^./_site/' | grep './drafts/'); do + l="$(grep '^lang: ..$' "$f" | awk '{print $2}')" + if [[ "$l" != 'en' ]]; then + ref="$(grep '^ref: ' "$f" | awk '{print $2}')" + FROM=$(find $(find . -name '*.md' -exec grep -l "^ref: $ref$" {} \;) -exec grep -l '^lang: en$' {} \;) + po2md "$FROM" --pofiles "locale/$l/LC_MESSAGES/$ref.po" --quiet --save "$f" + fi +done diff --git a/tests.sh b/tests.sh index 6180d94..9fc50c9 100755 --- a/tests.sh +++ b/tests.sh @@ -10,4 +10,4 @@ set -x ./scripts/assert-todos.sh ./scripts/assert-content.sh -./scripts/assert-translations.sh +./scripts/sync-translations.sh -- cgit v1.2.3