Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way that I don't have to build a few different pages for different languages? #154

Open
yingqi-chen opened this issue Sep 17, 2020 · 0 comments

Comments

@yingqi-chen
Copy link

To enable the translation feature, I use react-i18next. My file structure looks like this:

-src
  -locale
   -en
     -translation.js
   -zh
     -translation.js
  -pages
   -index.js
   -......js

So what is going on is that, I extract all the text on files in pages folder and put them in translation.js in different language folders, and when I click a button to change the language, all the files in pages will find the corresponding text from different language translation.js file accordingly.

But the route doesn't change at all. Is there a way for me to be able to do this: when I change the language, my route will change from /en/index to /zh/index?

I notice that in your instruction, you want me to set up different files for different languages in pages folder like:

File - src/pages/about.en.js

Is there a way that I don't have to build a few different pages for different languages? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant