aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2020-11-03 17:32:00 -0300
committerEuAndreh <eu@euandre.org>2020-11-03 17:33:11 -0300
commit485b5a2b2395eb8571630ac7996bf9aab7f3c35d (patch)
tree0758ac39b901493ab3fcc0db2c139c5b54f57b46
parentsync-translations.sh: Disable generating translated files for now (diff)
downloadeuandre.org-485b5a2b2395eb8571630ac7996bf9aab7f3c35d.tar.gz
euandre.org-485b5a2b2395eb8571630ac7996bf9aab7f3c35d.tar.xz
Fail tests when translations are not in sync
Diffstat (limited to '')
-rwxr-xr-xscripts/sync-translations.sh11
-rwxr-xr-xtests.sh2
2 files changed, 10 insertions, 3 deletions
diff --git a/scripts/sync-translations.sh b/scripts/sync-translations.sh
index 67d3609..149c7ff 100755
--- a/scripts/sync-translations.sh
+++ b/scripts/sync-translations.sh
@@ -16,12 +16,19 @@ for f in $(find . -type f -name '*.md' | grep -v '^./vendor' | grep -v '^./_site
fi
done
-for f in $(find . -type f -name '*.md' | grep -v '^./vendor/' | grep -v '^./_site/' | grep -v './drafts/' | grep -v './templates/'); do
+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$' {} \;)
- echo po2md "$FROM" --pofiles "locale/$l/LC_MESSAGES/$ref.po" --quiet --save "$f"
+ po2md "$FROM" --pofiles "locale/$l/LC_MESSAGES/$ref.po" --quiet --save "$f"
fi
done
+
+if [[ "${1:-}" = '--check' ]]; then
+ git diff --quiet || {
+ echo 'Translations are not in sync.'
+ exit 1
+ }
+fi
diff --git a/tests.sh b/tests.sh
index 9fc50c9..76d71d2 100755
--- a/tests.sh
+++ b/tests.sh
@@ -10,4 +10,4 @@ set -x
./scripts/assert-todos.sh
./scripts/assert-content.sh
-./scripts/sync-translations.sh
+./scripts/sync-translations.sh --check