feat: allow any valid ISO locale code in validation #1583
Merged
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.
Summary
en-NZ,de-LU,es-CO,ar-DZ, etc. that follow ISO standards but weren't previously in the hardcoded listChanges
packages/spec/src/locales.tsisValidLocalefrom@lingo.dev/_localespackagelocaleCodeSchemato use comprehensive ISO standard validation instead of hardcoded list checkpackages/spec/package.json@lingo.dev/_localesas a workspace dependencyValidation Coverage
The updated validation accepts locales conforming to:
en,es,de)Hans,Latn,Cyrl)US,GB,CN)419for Latin America)Test Results
✅ All existing tests pass:
packages/spec/src/locales.spec.ts- 14 tests passingpackages/spec/src/config.spec.ts- 5 tests passingManual Testing
Verified new locale codes are accepted:
en-NZ(New Zealand English)de-LU(Luxembourg German)es-CO(Colombian Spanish)pt-AO(Angolan Portuguese)ar-DZ(Algerian Arabic)sr-Latn-ME(Serbian Latin Montenegro)uz-Cyrl-UZ(Uzbek Cyrillic)Invalid codes are still rejected:
invalid-XXxx-USen-ZZZZBenefits
Test Plan
pnpm testin packages/specpnpm -r buildfor full monorepo build