mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
feat(languageSchema): split value to extract only language and not country code
pt-BR becomes pt en-US becomes en
This commit is contained in:
parent
f3b7f91a07
commit
0d126ad3b7
1 changed files with 1 additions and 1 deletions
|
|
@ -42,7 +42,7 @@ const fileSchema = z.custom<File>((value) => value instanceof File);
|
|||
const percentageSchema = z.coerce.number().int().gte(1).lte(100);
|
||||
|
||||
const languageSchema = z.string().transform((val, ctx) => {
|
||||
val = val.toLowerCase();
|
||||
val = (val.toLowerCase()).split('-')[0]; // pt-BR -> pt
|
||||
if (!ISO6391.validate(val)) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue