Fix localization JSON + linting workflow#43
Fix localization JSON + linting workflow#43printminion-co wants to merge 2 commits intoionos-devfrom
Conversation
d1b7f53 to
f8415d3
Compare
This commit introduces a new GitHub Actions workflow for linting localization JSON files. The workflow checks for valid JSON syntax in the l10n directory during pull requests, ensuring that all localization files are correctly formatted before merging. The linting process runs on a dedicated job and provides a summary status to indicate any issues found. Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
f8415d3 to
0630f19
Compare
…d save message Updated translation strings across multiple language files to ensure consistency in the message prompting users to save their passwords for security reasons. This change enhances the user experience by providing clear and accurate instructions in various languages. Should be done in 48cc7ad Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
There was a problem hiding this comment.
Pull request overview
Adds automated linting for Nextcloud Mail localization (l10n) JSON files to prevent invalid translation files, and normalizes affected translations to comply with the new rules.
Changes:
- Added a dedicated GitHub Actions workflow to lint
l10n/*.jsonon pull requests (with path-based skipping). - Extended ESLint config + dependencies to parse and lint
l10nJSON viaeslint-plugin-jsonc. - Fixed trailing-comma/formatting issues in several
l10n/*.jsonfiles and added npm scripts to run/fix the linter locally.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
package.json |
Adds lint:l10n scripts and the eslint-plugin-jsonc devDependency. |
package-lock.json |
Locks eslint-plugin-jsonc and its transitive dependencies; aligns lockfile metadata with package.json. |
.eslintrc.js |
Adds an ESLint override to parse/lint l10n/*.json using jsonc-eslint-parser. |
.github/workflows/lint-l10n.yml |
New PR workflow to lint localization JSON only when relevant files change. |
l10n/sv.json |
Removes invalid trailing comma at end of translations map. |
l10n/nl.json |
Removes invalid trailing comma at end of translations map. |
l10n/it.json |
Removes invalid trailing comma at end of translations map. |
l10n/fr.json |
Removes invalid trailing comma at end of translations map. |
l10n/es.json |
Fixes trailing comma + formatting around pluralForm boundary. |
l10n/en_GB.json |
Adds missing comma to keep JSON valid when followed by more entries. |
l10n/de_DE.json |
Removes invalid trailing comma at end of translations map. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| files: ['l10n/*.json'], | ||
| parser: 'jsonc-eslint-parser', | ||
| plugins: ['jsonc'], | ||
| rules: { | ||
| // Catch trailing commas (the class of bug that broke translations in commit 48cc7ad) | ||
| 'jsonc/comma-dangle': ['error', 'never'], | ||
| // Disable JS-style rules inherited from @nextcloud that produce noise on auto-generated files | ||
| 'comma-spacing': 'off', | ||
| 'eol-last': 'off', | ||
| 'no-irregular-whitespace': 'off', | ||
| }, |
There was a problem hiding this comment.
The override uses jsonc-eslint-parser, which will successfully parse JSONC features like comments. Without an explicit rule, a PR could introduce // or /* */ comments in l10n/*.json and npm run lint:l10n would still pass even though the files would no longer be valid JSON for runtime consumers. Consider adding a JSONC rule (e.g. jsonc/no-comments: 'error', and/or otherwise enforcing strict JSON) in this override so the linter blocks commented translation files.
| changes: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
|
|
There was a problem hiding this comment.
changes and summary jobs only run lightweight steps (paths-filter / a single shell check). Other workflows in this repo run these kinds of jobs on ubuntu-latest-low (e.g. .github/workflows/lint-eslint.yml) to reduce CI resource usage; consider switching runs-on for these jobs to ubuntu-latest-low as well.
This pull request introduces automated linting for localization (
l10n) JSON files and improves their consistency. The main changes include setting up a dedicated GitHub Actions workflow for linting, updating ESLint configuration to properly handle JSON files, and adding new npm scripts to make linting easier. Additionally, some minor formatting corrections were made to the localization files themselves.Automation and Tooling Improvements:
.github/workflows/lint-l10n.yml) to automatically lintl10nJSON files on pull requests, ensuring translation files remain valid and free of common errors.package.jsonto introducelint:l10nandlint:l10n:fixnpm scripts for easier manual linting and fixing ofl10nJSON files.eslint-plugin-jsoncas a development dependency inpackage.jsonto enable JSON-specific linting rules.ESLint Configuration Enhancements:
.eslintrc.jsto add an override forl10n/*.jsonfiles, usingjsonc-eslint-parserand thejsoncplugin. This enforces no trailing commas and disables noisy JS rules for these files.Localization File Consistency:
l10n/*.jsonfiles to comply with stricter linting rules. [1] [2] [3] [4] [5] [6] [7]