feat: Add i18n linting rules for #3933 - #5204
Open
akankshahu wants to merge 3 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces i18n-specific linting checks for the Mathesar UI to improve translation key hygiene and enforce formatting/usage constraints, aligning with issue #3933.
Changes:
- Add Python scripts to validate translation key presence, ICU plural/message syntax, and required variables in translation calls.
- Add an
npm run lint-i18nscript to run the i18n checks. - Add a local ESLint rule intended to disallow
svelte-i18nusage insidesrc/component-library.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
mathesar_ui/scripts/i18n/check_translation_variables.py |
Adds a check that translation calls provide required ICU variables based on dict.json. |
mathesar_ui/scripts/i18n/check_missing_strings.py |
Adds a check that translation keys used in code exist in dict.json. |
mathesar_ui/scripts/i18n/check_icu_format.py |
Adds a check intended to validate ICU MessageFormat/plural syntax in dict.json. |
mathesar_ui/package.json |
Adds lint-i18n script to run the new/existing i18n checks. |
mathesar_ui/eslint-local-rules/no-i18n-in-component-library.cjs |
Introduces a local ESLint rule intended to prevent svelte-i18n usage in component-library code. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add check_missing_strings.py to verify all used translation keys exist in dict - Add check_icu_format.py to validate ICU MessageFormat syntax and plurals - Add check_translation_variables.py to ensure function calls have required variables - Add lint-i18n npm script to run all i18n checks - Add no-i18n-in-component-library ESLint rule (component-library already excluded) All essential and good-to-have requirements from issue mathesar-foundation#3933 are now implemented. Signed-off-by: akankshahu <akanksha.kumari.s84@kalvium.community>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All essential and good-to-have requirements from issue #3933 are now implemented.
Fixes #3933
Technical details
Screenshots
Checklist
Update index.md).developbranch of the repositoryvisible errors.
Developer Certificate of Origin
Developer Certificate of Origin