Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/allow-valid-locale-codes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lingo.dev/_spec": minor
---

Allow any valid ISO locale code in validation instead of hardcoded list. Validation now accepts any locale conforming to ISO 639-1, ISO 15924, ISO 3166-1, and UN M.49 standards.
8 changes: 7 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@

## Testing

- When you add tests - make sure they pass
- When you add tests - make sure they pass

## Changesets

- Every PR must include a changeset
- Create changeset: `pnpm new` from repo root
- For changes that don't need a release (e.g., README updates): `pnpm new:empty`
1 change: 1 addition & 0 deletions packages/spec/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"author": "",
"license": "Apache-2.0",
"dependencies": {
"@lingo.dev/_locales": "workspace:*",
"zod": "^3.25.76",
"zod-to-json-schema": "^3.24.5"
},
Expand Down
7 changes: 6 additions & 1 deletion packages/spec/src/locales.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Z from "zod";
import { isValidLocale } from "@lingo.dev/_locales";

const localeMap = {
// Urdu (Pakistan)
Expand Down Expand Up @@ -246,7 +247,11 @@ export const localeCodes = [
] as LocaleCode[];

export const localeCodeSchema = Z.string().refine(
(value) => localeCodes.includes(value as any),
(value) => {
// Normalize locale before validation
const normalized = normalizeLocale(value);
return isValidLocale(normalized);
},
{
message: "Invalid locale code",
},
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.