BugFix: fixed translation formating

This commit is contained in:
2024-02-17 09:41:35 +01:00
parent 716fda63f1
commit fcd94408fe
8 changed files with 17 additions and 21 deletions

View File

@@ -26,7 +26,7 @@ export type State = {
*/
const FormSchema = (t:IntlTemplateFn) => z.object({
_id: z.string(),
billName: z.coerce.string().min(1, t("bill-name-required")),
billName: z.coerce.string().min(1, t("validation.bill-name-required")),
billNotes: z.string(),
payedAmount: z.string().nullable().transform((val, ctx) => {
@@ -39,7 +39,7 @@ const FormSchema = (t:IntlTemplateFn) => z.object({
if (isNaN(parsed)) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: t("not-a-number"),
message: t("validation.not-a-number"),
});
// This is a special symbol you can use to
@@ -52,7 +52,7 @@ const FormSchema = (t:IntlTemplateFn) => z.object({
if (parsed < 0) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: t("negative-number")
message: t("validation.negative-number")
});
// This is a special symbol you can use to
@@ -115,7 +115,7 @@ export const updateOrAddBill = withUser(async (user:AuthenticatedUser, locationI
const { id: userId } = user;
const t = await getTranslations("bill-edit-form.validation");
const t = await getTranslations("bill-edit-form");
// FormSchema
const validatedFields = FormSchema(t)
@@ -131,7 +131,7 @@ export const updateOrAddBill = withUser(async (user:AuthenticatedUser, locationI
console.log("updateBill.validation-error");
return({
errors: validatedFields.error.flatten().fieldErrors,
message: t("form-error-message"),
message: t("validation.form-error-message"),
});
}