Missing translation on React Native. Yup doesn't work properly with i18n
See original GitHub issueI have this piece of a code. I want to add error messages depending on user’s locale, but yup throws errors, same if fields are filled in incorrectly
[missing “en.login.emailRequiredError” translation] [missing “en.login.passRequiredError” translation]
const schema = yup.object().shape({ email: yup .string() .email(i18n.t('login.emailSpellError')) .required(i18n.t('login.emailRequiredError')), password: yup .string() .matches(/^((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,15})$/i, i18n.t('login.passSpellError')) .required(i18n.t('login.passRequiredError')), });
i18n.t(‘login.passRequiredError’) works fine when I put it into a render method for checking it but it does not work with the yup. Any suggestions? Thanks in advance
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Yup doesn't work properly with i18n - Stack Overflow
The goal here is to move the t() method into your render method and have all translations happen there. Share.
Read more >Internationalization - React Made Native Easy
It integrates i18n.js with React Native and uses the user preferred locale ... for the testers/devs to know if a translation is missing...
Read more >Tutorial - Internationalization of React apps - LinguiJS - JS.ORG
Through this tutorial, we'll learn how to add internationalization (i18n) to an existing application in React JS. Let's Start¶. We're going to translate...
Read more >The complete guide to internationalization in Next.js
Learn how to make your Next.js app international with smooth translation features in this advanced, step-by-step tutorial.
Read more >Fallback - i18next documentation
By default, if a variant (containing region, script, etc) is not found, i18next will look for the same key in the broader version...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks, I found out the issue, it was a wrong place of i18n initialization. My bad
Maybe they don’t exist when yup schema is created, i’m not sure. The error you’ve posted though is not a Yup, one it’s being thrown by your code. There isn’t much I can do unfortunately, i’d suggest walking through the code with the debugger and seeing where it breaks.