Whenever a user visits my site the first time, they have no cookie stored yet. It then always defaults to English. My html document has the lang attribute 'nl'. The priority of the html tag is however lower than the cookie, but even when a cookie is not found it will choose 'en' (and giving the tag a higher priority than the cookie makes it so you can't swap languages). Thanks!
Asked
Active
Viewed 252 times
1 Answers
0
In react-i18next you can set the fallback language like this:
i18next.init({
fallbackLng: 'nl'
});
It is explained in the documentation about fallback

dpMelian
- 26
- 3
-
I had that, but whenever I removed all the cookies & data and then went to the website it still was english. Maybe it's a browser setting somewhere? – Jasper Mar 07 '21 at 18:55
-
1Maybe yeah, you could try [this script](https://stackoverflow.com/questions/8199760/how-to-get-the-browser-language-using-javascript) to find out what language your browser is set to – dpMelian Mar 08 '21 at 19:56