Skip to content

feat: Add i18n linting rules for #3933 - #5204

Open
akankshahu wants to merge 3 commits into
mathesar-foundation:developfrom
akankshahu:rupu
Open

feat: Add i18n linting rules for #3933#5204
akankshahu wants to merge 3 commits into
mathesar-foundation:developfrom
akankshahu:rupu

Conversation

@akankshahu

@akankshahu akankshahu commented Feb 10, 2026

Copy link
Copy Markdown
Contributor
  • 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 #3933 are now implemented.

Fixes #3933

Technical details

Screenshots

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the develop branch of the repository
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no
    visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

Copilot AI review requested due to automatic review settings February 10, 2026 05:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-i18n script to run the i18n checks.
  • Add a local ESLint rule intended to disallow svelte-i18n usage inside src/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.

Comment thread mathesar_ui/package.json
Comment thread mathesar_ui/scripts/i18n/check_missing_strings.py Outdated
Comment thread mathesar_ui/scripts/i18n/check_icu_format.py Outdated
Comment thread mathesar_ui/scripts/i18n/check_translation_variables.py
Comment thread mathesar_ui/eslint-local-rules/no-i18n-in-component-library.cjs
- 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Internationalization linting rules

2 participants