1
0
mirror of synced 2026-01-07 00:01:39 -05:00

Lint translation files (#17561)

### Why:

A lot of content gets mistranslated, some common patterns are: frontmatter date and enums getting translated, liquid tags get translated or go missing during the translation process. These translation errors are tough to catch, especially when they often come in huge PRs. 

### What's being changed:

- Frontmatter is also getting linted against schema as part of `lint-files`
- When an environment variable `TEST_TRANSLATION` is passed,
   - `lint-files` will run its tests against all files that have been newly translated (by git-diffing between `translations` branch and `main` branch), and
   - results are outputted using a custom jest reporter. The output is formatted in a way that makes it easy to exclude the problematic translated files from being merged, and to share the errors with [localization support](https://github.com/github/localization-support/issues/489). 
- Run the implemented translation test as part of the existing `Node.js Tests - Translations` workflow
This commit is contained in:
Vanessa Yuen
2021-02-01 17:59:33 +01:00
committed by GitHub
parent 37fd4bd872
commit a1d93a7619
5 changed files with 170 additions and 54 deletions

View File

@@ -17,6 +17,9 @@ jobs:
with:
ref: translations # check out the 'translations' branch
- name: Check out tip of main
run: git fetch --depth=1 origin main
- name: Setup node
uses: actions/setup-node@c46424eee26de4078d34105d3de3cc4992202b1e
with:
@@ -41,6 +44,9 @@ jobs:
- name: Run linter
run: npx eslint .
- name: Lint translated content
run: npm run lint-translation
- name: Check dependencies
run: npm run check-deps