mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #13981 from overleaf/jpa-i18n-ci-lint-fix
[web] split check of extracted-translations from linting of locales GitOrigin-RevId: bfd5953673ed58e4e7d384129535f4a452cc1041
This commit is contained in:
parent
752ad8870d
commit
d0dedd5ef2
3 changed files with 28 additions and 21 deletions
|
@ -466,6 +466,10 @@ lint: lint_locales
|
||||||
lint_locales:
|
lint_locales:
|
||||||
bin/lint_locales
|
bin/lint_locales
|
||||||
|
|
||||||
|
lint: check_extracted_translations
|
||||||
|
check_extracted_translations:
|
||||||
|
bin/check_extracted_translations
|
||||||
|
|
||||||
sort_locales:
|
sort_locales:
|
||||||
node scripts/translations/sort.js
|
node scripts/translations/sort.js
|
||||||
|
|
||||||
|
|
24
services/web/bin/check_extracted_translations
Executable file
24
services/web/bin/check_extracted_translations
Executable file
|
@ -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 <<MSG >&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
|
|
@ -11,27 +11,6 @@ node scripts/translations/cleanupUnusedLocales.js --check
|
||||||
# Ensure all locales use the same variables
|
# Ensure all locales use the same variables
|
||||||
node scripts/translations/checkVariables.js --ignore-orphaned-translations
|
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 <<MSG >&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.
|
# Ensure no locales contain single quotes.
|
||||||
LOCALES_WITH_SINGLE_QUOTE=$(\
|
LOCALES_WITH_SINGLE_QUOTE=$(\
|
||||||
grep \
|
grep \
|
||||||
|
|
Loading…
Reference in a new issue