You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(locales): add comprehensive ISO 639-2/3 language code validation (#1614)
* feat(locales): add comprehensive ISO 639-2/3 language code validation
Replaces hardcoded ISO 639-1 (2-letter) language code list with the
comprehensive iso-639-3 package, which validates against all ISO 639
standards including:
- ISO 639-1 codes (2-letter, ~184 languages)
- ISO 639-2 codes (3-letter bibliographic and terminologic)
- ISO 639-3 codes (3-letter, ~8,000 languages)
This fixes validation issues with 3-letter language codes that don't
have 2-letter equivalents, such as:
- fil (Filipino)
- bar (Bavarian)
- nap (Neapolitan)
- zgh (Standard Moroccan Tamazight)
Changes:
- Add iso-639-3 package dependency to @lingo.dev/_locales
- Update validation.ts to use iso-639-3 for comprehensive validation
- Remove hardcoded list of 184 language codes (now 8,000+ supported)
- Add 5 new tests covering 3-letter language code validation
- All 88 tests passing
Fixes validation error: "Unsupported locale: fil"
* fix(locales): bundle iso-639-3 to resolve ESM/CJS compatibility
The iso-639-3 package is ESM-only, which caused build failures when
the spec package tried to import the locales CJS bundle.
Solution: Configure tsup to bundle iso-639-3 into the output using
noExternal option. This allows the CJS build to work properly.
Fixes CI build error: ERR_REQUIRE_ESM
* fix(compiler): remove duplicate providers from test expectations
The test had duplicate entries for 'openai' and 'anthropic' which
caused the test to fail. Removed the duplicates to match the actual
provider list.
This was an existing bug unrelated to the locale validation changes.
* Update packages/locales/src/validation.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
0 commit comments