Open jeremieflrnt opened 1 year ago
The best I'm able to do is to use the getFixedT function to set the correct language according to the locale of the test:
export const testI18n = baseTest.extend(i18nFixture).extend<{ tFixed: TFunction }>({
tFixed: async ({ i18n, locale }, use) => {
if (locale === 'fr-FR') await use(i18n.getFixedT('fr'));
else await use(i18n.getFixedT('es'));
}
});
It's working, but it does not seems to be ideal...
Hi, Great plugin there, thanks! I've used it for only one language at first, so I set lng directly and it's working fine!! But now I want to add a new language (add tests to the same website, but with a different locale / language), and I can't make it work.. Can you help? Did you have to manage this use case?
Thanks!
What is the current behavior? I remove the
lng
key inoptions
and I added:plugins: [LanguageDetector]
withimport LanguageDetector from 'i18next-browser-languagedetector';
And now, it can't find the right language of the website (I use a locale on playwright project, and on the website, the html tag as a
lang
attribute)Debug mode tells me:
Steps to reproduce it and if possible a minimal demo of the problem. Paste the link to your JSFiddle or CodeSandbox example below:
What is the expected behavior? I expect to have the correct translations of the website under test A little about versions:
react-use
: