fix: add locale duplication validator to prevent zh_CN/zh_Hans conflicts #257
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.
Fixes
Fixes #245 (implements optional task #6)
Summary of Changes
scripts/validate-locales.js
- Node.js script that validates locale folder naming and detects duplicatesnpm run check
workflow (runs automatically with linting)npm run validate:locales
command for manual validationCONTRIBUTING.md
with canonical locale naming guidelines and best practicesScreenshots / Demo (if UI-related)
Validation passing with current locales:
Locale Validation Report:
Found 13 locale folder(s): de, en, es, fr, hi, id, ja, pt, pt_BR, ru, vi, zh_CN, zh_TW
All locale folders are valid. No duplicates detected.
Validation catching duplicate (tested with temporary zh_Hans folder):
Locale Validation Report:
Found 14 locale folder(s): de, en, es, fr, hi, id, ja, pt, pt_BR, ru, vi, zh_CN, zh_Hans, zh_TW
Errors found:
Duplicate locale detected: 'zh_Hans' should use 'zh_CN' instead
Conflict: Both 'zh_CN' and 'zh_Hans' exist. Keep only 'zh_CN'
Tip: Use the canonical locale codes defined in Chrome i18n standards.
See: https://developer.chrome.com/docs/extensions/reference/api/i18n
Checklist
Reviewer Notes
Context: The
zh_Hans
folder does not currently exist in the repository (may have been removed previously or exists only in Weblate configuration). However, implementing this lint guard prevents the issue from recurring.Why this solution provides value:
messages.json
How to test: