Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

218
Views
Lingui and yup validator in NextJS

I have a setup with react-hook-form, yup in NextJS for form validation. Lingui for internationalization (followed this documentation). How to setup internationalization in yup validator which is supported by Lingui?

The problem here I am facing is after changing the language, the errors from yup validator is in English.

// src/validation/auth.js

import * as yup from 'yup';
import { t } from '@lingui/macro';

export const signupEmailSchema = yup.object({
  email: yup
    .string()
    .email(
      t({
        id: 'email-valid-validation',
        message: 'Must be a valid email',
      })
    )
    .required(
      t({
        id: 'email-required-validation',
        message: 'Email is a required field',
      })
    ),
});
// pages/auth.js


export const Auth = () => {

 const {
    handleSubmit,
    control,
    formState: { errors },
  } = useForm({ resolver: yupResolver(signupEmailSchema) });
}

    <Controller
       name='email'
       control={control}
       render={({ field }) => (
                 <Input
                   placeholder='johndoe@gmail.com'
                      {...field}
                      ref={null}
                    />
              )}
     />
                {errors.email && (
                  <DangerText>
                    // need to display translated errors here
                  </DangerText>
                )}
}

Thank you.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!