Skip to content
This repository has been archived by the owner on Jan 1, 2024. It is now read-only.

is the multilingual part done? #23

Closed
PharrellWANG opened this issue Jul 10, 2017 · 6 comments
Closed

is the multilingual part done? #23

PharrellWANG opened this issue Jul 10, 2017 · 6 comments

Comments

@PharrellWANG
Copy link

@Metnew
Hi, Metnew!
I'm here asking a question instead of raising an issue:
Since I cannot see where the button for switching the language is, I kind of cannot get the sense of how to use the multilingual update of version 3. Now I build it without flags, it is supposed to be built with all available languages. But how to switch between the two languages currently available after building for production?
Thanks!

@Metnew
Copy link
Owner

Metnew commented Jul 10, 2017

Hello, @PharrellWANG!
Just run npm run build, webpack bundles 2 apps with both languages.
Check i18n folder, you can find i18n object here. This is an example of how i18n-webpack-plugin works: https://github.com/webpack/webpack/tree/master/examples/i18n
After bundling 2 apps with different languages you can not switch to another language directly, without custom server, I recommend you next way:

  1. Create server (or use code from ssr server)
  2. Create endpoint /i18n
  3. After request from app to this endpoint, change the dist path (path from where you serve app). Example: path is /dist/en -> request to /i18n -> send new index.html from /dist/ru

Or you can build 2 apps, and serve one app from path / and version with another language from path /ru. It's easier than previous method. Don't forget to change basename in getHistory() in src/common/routing/index.js for React-Router + change <base href> in index.html for this version + I recommend you to check how webpack handles BUILD_DEMO - I use this env variable to build gh-pages.

@PharrellWANG
Copy link
Author

@Metnew
Okay, let me try it. Thank you~

@Metnew
Copy link
Owner

Metnew commented Jul 11, 2017

I'm currently working on moving a demo from gh-pages to zeit's now. So all custom code for deploying to gh-pages (e.g. process.env.BUILD_DEMO) will be removed. Also, I'm going to implement described above feature with i18n.

@PharrellWANG
Copy link
Author

@Metnew
Ok, thanks~
By the way, when I do npm run dev, the project can be compiled successfully. But there's an error:
error
I cannot figure it out. Do you have the same issue when npm run dev?

@Metnew
Copy link
Owner

Metnew commented Jul 12, 2017

@PharrellWANG
Yeah, I have the same error. Probably, it is caused by requiring of non-js file (I guess index.html, because it's the only non-js file in repo) that is parsed by babel-loader.
I'll try to fix it after improving server part + complete full migration to zeit's now. Also, I recommend you to check dev branch.

@PharrellWANG
Copy link
Author

@Metnew Okay and I'll close this issue.

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

No branches or pull requests

2 participants