diff --git a/.travis.yml b/.travis.yml index f8c869972..7cfb983cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,8 @@ script: - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi) - echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, PR=$PR, BRANCH=$BRANCH" # Miscellaneous - - ./scripts/sort-translations.sh + - ./scripts/translations/sort.sh + - ./scripts/translations/missing-keys.sh # Backend - docker-compose exec backend yarn run lint - docker-compose exec backend yarn run test --ci --verbose=false --coverage diff --git a/scripts/translations/missing-keys.sh b/scripts/translations/missing-keys.sh new file mode 100755 index 000000000..d2de1105f --- /dev/null +++ b/scripts/translations/missing-keys.sh @@ -0,0 +1,14 @@ +#! /usr/bin/env bash + +ROOT_DIR=$(dirname "$0")/.. +english="$ROOT_DIR/webapp/locales/en.json" +german="$ROOT_DIR/webapp/locales/de.json" +listPaths="jq -c 'path(..)|[.[]|tostring]|join(\".\")'" +if eval "diff -q <( $listPaths < $english ) <( $listPaths < $german )"; +then + : # all good +else + eval "diff -y <( $listPaths < $english ) <( $listPaths < $german )"; + printf "\nEnglish and German translation keys do not match, see diff above.\n" + exit 1 +fi diff --git a/scripts/sort-translations.sh b/scripts/translations/sort.sh similarity index 100% rename from scripts/sort-translations.sh rename to scripts/translations/sort.sh