diff --git a/services/web/Makefile b/services/web/Makefile index 49d87efe4a..25d2639e01 100644 --- a/services/web/Makefile +++ b/services/web/Makefile @@ -466,6 +466,10 @@ lint: lint_locales lint_locales: bin/lint_locales +lint: check_extracted_translations +check_extracted_translations: + bin/check_extracted_translations + sort_locales: node scripts/translations/sort.js diff --git a/services/web/bin/check_extracted_translations b/services/web/bin/check_extracted_translations new file mode 100755 index 0000000000..05a7655139 --- /dev/null +++ b/services/web/bin/check_extracted_translations @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e + +# Ensure all locales used in the frontend are tracked +OUTPUT=data/dumpFolder/i18next-scanner +trap "rm -rf $OUTPUT" EXIT +npx i18next-scanner --output "$OUTPUT" +ACTUAL=frontend/extracted-translations.json +EXPECTED="$OUTPUT/frontend/extracted-translations.json" +if ! diff "$ACTUAL" "$EXPECTED"; then + cat <&2 + +services/web/frontend/extracted-translations.json is not up-to-date. + +--- +Try running: + + internal$ bin/run web npm run extract-translations + +--- +MSG + exit 1 +fi diff --git a/services/web/bin/lint_locales b/services/web/bin/lint_locales index 158e06f973..eceefe0ae5 100755 --- a/services/web/bin/lint_locales +++ b/services/web/bin/lint_locales @@ -11,27 +11,6 @@ node scripts/translations/cleanupUnusedLocales.js --check # Ensure all locales use the same variables node scripts/translations/checkVariables.js --ignore-orphaned-translations -# Ensure all locales used in the frontend are tracked -OUTPUT=data/dumpFolder/i18next-scanner -trap "rm -rf $OUTPUT" EXIT -npx i18next-scanner --output "$OUTPUT" -ACTUAL=frontend/extracted-translations.json -EXPECTED="$OUTPUT/frontend/extracted-translations.json" -if ! diff "$ACTUAL" "$EXPECTED"; then - cat <&2 - -services/web/frontend/extracted-translations.json is not up-to-date. - ---- -Try running: - - internal$ bin/run web npm run extract-translations - ---- -MSG - exit 1 -fi - # Ensure no locales contain single quotes. LOCALES_WITH_SINGLE_QUOTE=$(\ grep \