issaafalkattan / react-landing-page-template-2021

A sleek plug n play react landing page template.
https://react-landing-page-template-2021.vercel.app
MIT License
549 stars 294 forks source link

Language selection #11

Closed smolendawid closed 2 years ago

smolendawid commented 2 years ago

Describe the solution you'd like I'm looking for a way to add support for a few languages. The way I imagine that is that you can see the flag icon in the header and after clicking it, you can see other flags that will convert the webpage to another language.

There are a few problems with the fact that not all the strings in the page come from config/index.json. However the real problem for me is that I don't know how o dynamically change the content of the config/index.js, so that the correct language is reloaded. Should I add another field in the config/index.js or create something like config/index-nl.js?

I'm not experienced frontend developer so I don't really know the conventions.

Thanks

issaafalkattan commented 2 years ago

This https://react.i18next.com/ could be a really good solution to your problem! Then you would have as many versions of the index.json as you have languages, and would need to change from using index.json data directly to using something like useTranslation or translate() which are utils that i18n-react gives!

I hadn't planned on adding multilinguel support for now, but if i get the time I'll try adding it to the template!

smolendawid commented 2 years ago

Thank you for the hint. I'll try to add it, I think adding it to the template would make this great code more close to the ultimate solution.