From 3aa95753f24f2201b86d3b354c9d9dc0a5ea1701 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sat, 11 Jul 2026 14:50:13 +0300 Subject: [PATCH] Improve error message, particularly on the user card edit page --- app/form/fields.ts | 4 ++-- locales/da/forms.json | 1 + locales/de/forms.json | 1 + locales/en/forms.json | 1 + locales/es-ES/forms.json | 1 + locales/es-US/forms.json | 1 + locales/fr-CA/forms.json | 1 + locales/fr-EU/forms.json | 1 + locales/he/forms.json | 1 + locales/it/forms.json | 1 + locales/ja/forms.json | 1 + locales/ko/forms.json | 1 + locales/nl/forms.json | 1 + locales/pl/forms.json | 1 + locales/pt-BR/forms.json | 1 + locales/ru/forms.json | 1 + locales/zh/forms.json | 1 + 17 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/form/fields.ts b/app/form/fields.ts index ead8ee0b6..788b5d67a 100644 --- a/app/form/fields.ts +++ b/app/form/fields.ts @@ -241,7 +241,7 @@ export function numberField( ) { return z.coerce .number() - .int() + .int({ message: "forms:errors.mustBeWholeNumber" }) .nonnegative() .register(formRegistry, { ...args, @@ -270,7 +270,7 @@ export function numberFieldOptional( ) { return z.coerce .number() - .int() + .int({ message: "forms:errors.mustBeWholeNumber" }) .nonnegative() .optional() .register(formRegistry, { diff --git a/locales/da/forms.json b/locales/da/forms.json index 49f20f051..31def925a 100644 --- a/locales/da/forms.json +++ b/locales/da/forms.json @@ -58,6 +58,7 @@ "errors.required": "", "errors.minLength": "", "errors.maxLength": "", + "errors.mustBeWholeNumber": "", "errors.invalidUrl": "", "errors.notAllowedCharacters": "", "errors.atLeastOneOption": "", diff --git a/locales/de/forms.json b/locales/de/forms.json index ba2cd3dde..1a1fd535f 100644 --- a/locales/de/forms.json +++ b/locales/de/forms.json @@ -58,6 +58,7 @@ "errors.required": "", "errors.minLength": "", "errors.maxLength": "", + "errors.mustBeWholeNumber": "", "errors.invalidUrl": "", "errors.notAllowedCharacters": "", "errors.atLeastOneOption": "", diff --git a/locales/en/forms.json b/locales/en/forms.json index c56a23593..70ac49dd3 100644 --- a/locales/en/forms.json +++ b/locales/en/forms.json @@ -58,6 +58,7 @@ "errors.required": "This field is required", "errors.minLength": "Must be at least {{min}} characters", "errors.maxLength": "Must be at most {{max}} characters", + "errors.mustBeWholeNumber": "Must be a whole number (no decimals)", "errors.invalidUrl": "Must be a valid URL", "errors.notAllowedCharacters": "Contains not allowed characters", "errors.atLeastOneOption": "At least one option must be selected", diff --git a/locales/es-ES/forms.json b/locales/es-ES/forms.json index e7067bad1..b04545e7d 100644 --- a/locales/es-ES/forms.json +++ b/locales/es-ES/forms.json @@ -58,6 +58,7 @@ "errors.required": "Este campo es obligatorio", "errors.minLength": "Debe tener al menos {{min}} caracteres", "errors.maxLength": "Debe tener como máximo {{max}} caracteres", + "errors.mustBeWholeNumber": "", "errors.invalidUrl": "Debe ser una URL válida", "errors.notAllowedCharacters": "Contiene caracteres no permitidos", "errors.atLeastOneOption": "Debe seleccionarse al menos una opción", diff --git a/locales/es-US/forms.json b/locales/es-US/forms.json index da96c8f39..9302b26b5 100644 --- a/locales/es-US/forms.json +++ b/locales/es-US/forms.json @@ -58,6 +58,7 @@ "errors.required": "", "errors.minLength": "", "errors.maxLength": "", + "errors.mustBeWholeNumber": "", "errors.invalidUrl": "", "errors.notAllowedCharacters": "", "errors.atLeastOneOption": "", diff --git a/locales/fr-CA/forms.json b/locales/fr-CA/forms.json index a637911fd..92fb252eb 100644 --- a/locales/fr-CA/forms.json +++ b/locales/fr-CA/forms.json @@ -58,6 +58,7 @@ "errors.required": "", "errors.minLength": "", "errors.maxLength": "", + "errors.mustBeWholeNumber": "", "errors.invalidUrl": "", "errors.notAllowedCharacters": "", "errors.atLeastOneOption": "", diff --git a/locales/fr-EU/forms.json b/locales/fr-EU/forms.json index 780d3f493..2237f0a5f 100644 --- a/locales/fr-EU/forms.json +++ b/locales/fr-EU/forms.json @@ -58,6 +58,7 @@ "errors.required": "", "errors.minLength": "", "errors.maxLength": "", + "errors.mustBeWholeNumber": "", "errors.invalidUrl": "", "errors.notAllowedCharacters": "", "errors.atLeastOneOption": "", diff --git a/locales/he/forms.json b/locales/he/forms.json index 7bb221243..7c019a4ee 100644 --- a/locales/he/forms.json +++ b/locales/he/forms.json @@ -58,6 +58,7 @@ "errors.required": "", "errors.minLength": "", "errors.maxLength": "", + "errors.mustBeWholeNumber": "", "errors.invalidUrl": "", "errors.notAllowedCharacters": "", "errors.atLeastOneOption": "", diff --git a/locales/it/forms.json b/locales/it/forms.json index f2940e0ff..679d6e286 100644 --- a/locales/it/forms.json +++ b/locales/it/forms.json @@ -58,6 +58,7 @@ "errors.required": "", "errors.minLength": "", "errors.maxLength": "", + "errors.mustBeWholeNumber": "", "errors.invalidUrl": "", "errors.notAllowedCharacters": "", "errors.atLeastOneOption": "", diff --git a/locales/ja/forms.json b/locales/ja/forms.json index cb120d585..d21ee2709 100644 --- a/locales/ja/forms.json +++ b/locales/ja/forms.json @@ -58,6 +58,7 @@ "errors.required": "", "errors.minLength": "", "errors.maxLength": "", + "errors.mustBeWholeNumber": "", "errors.invalidUrl": "", "errors.notAllowedCharacters": "", "errors.atLeastOneOption": "", diff --git a/locales/ko/forms.json b/locales/ko/forms.json index 01c9cc160..34bb82e82 100644 --- a/locales/ko/forms.json +++ b/locales/ko/forms.json @@ -58,6 +58,7 @@ "errors.required": "", "errors.minLength": "", "errors.maxLength": "", + "errors.mustBeWholeNumber": "", "errors.invalidUrl": "", "errors.notAllowedCharacters": "", "errors.atLeastOneOption": "", diff --git a/locales/nl/forms.json b/locales/nl/forms.json index dff99af00..7d32d3596 100644 --- a/locales/nl/forms.json +++ b/locales/nl/forms.json @@ -58,6 +58,7 @@ "errors.required": "", "errors.minLength": "", "errors.maxLength": "", + "errors.mustBeWholeNumber": "", "errors.invalidUrl": "", "errors.notAllowedCharacters": "", "errors.atLeastOneOption": "", diff --git a/locales/pl/forms.json b/locales/pl/forms.json index 6d0075125..0f3531f6c 100644 --- a/locales/pl/forms.json +++ b/locales/pl/forms.json @@ -58,6 +58,7 @@ "errors.required": "", "errors.minLength": "", "errors.maxLength": "", + "errors.mustBeWholeNumber": "", "errors.invalidUrl": "", "errors.notAllowedCharacters": "", "errors.atLeastOneOption": "", diff --git a/locales/pt-BR/forms.json b/locales/pt-BR/forms.json index 69dcc5fb3..1dbf18349 100644 --- a/locales/pt-BR/forms.json +++ b/locales/pt-BR/forms.json @@ -58,6 +58,7 @@ "errors.required": "", "errors.minLength": "", "errors.maxLength": "", + "errors.mustBeWholeNumber": "", "errors.invalidUrl": "", "errors.notAllowedCharacters": "", "errors.atLeastOneOption": "", diff --git a/locales/ru/forms.json b/locales/ru/forms.json index c251760b9..2b4094d99 100644 --- a/locales/ru/forms.json +++ b/locales/ru/forms.json @@ -58,6 +58,7 @@ "errors.required": "", "errors.minLength": "", "errors.maxLength": "", + "errors.mustBeWholeNumber": "", "errors.invalidUrl": "", "errors.notAllowedCharacters": "", "errors.atLeastOneOption": "", diff --git a/locales/zh/forms.json b/locales/zh/forms.json index 23d0448c7..5a9f21fea 100644 --- a/locales/zh/forms.json +++ b/locales/zh/forms.json @@ -58,6 +58,7 @@ "errors.required": "此项为必填项", "errors.minLength": "字数不能少于 {{min}} 个字符", "errors.maxLength": "字数不能多于 {{max}} 个字符", + "errors.mustBeWholeNumber": "", "errors.invalidUrl": "请输入有效的 URL 地址", "errors.notAllowedCharacters": "包含非法字符", "errors.atLeastOneOption": "请至少选择一个选项",