Issue 7127 - Added translation file linting
This MR for #82 (closed) contains the following changes:
- Added build/locale-linter
- Added unit tests for linter
- Specified Node-environment for linting build directory
So far, it already found seven mistakes which I reported to C&T and which have already been fixed on Crowdin by now. Check out the pipeline to see its output. Fixing the last two linting errors will reveal two more errors:
Error: Unexpected tag
Failed to validate string 'firstRun_fair_description'
Failed to validate 'adblockplusui/locale/tr/first-run.json'
at validate (adblockplusui/build/locale-linter/validators/tags.js:29:13)
at validate (adblockplusui/build/locale-linter/validators/strings.js:41:7)
at run (adblockplusui/build/locale-linter/index.js:38:7)
at <anonymous>
Error: Unexpected tag
Failed to validate string 'enabled_for_site'
Failed to validate 'adblockplusui/locale/ur/popup.json'
at validate (adblockplusui/build/locale-linter/validators/tags.js:29:13)
at validate (adblockplusui/build/locale-linter/validators/strings.js:41:7)
at run (adblockplusui/build/locale-linter/index.js:38:7)
at <anonymous>
Note that the linter doesn't yet compare the file contents with the ones from the defaul locale since such a check would only make sense after we fetch all translations because until then we'd be getting all sorts of expected mismatches. Therefore I'd say we should add such checks later on and only run them when importing translations and/or before finalizing a release.
Edited by Thomas Greiner