Giter Site home page Giter Site logo

is the multilingual part done? about suicrux HOT 6 CLOSED

metnew avatar metnew commented on May 2, 2024
is the multilingual part done?

from suicrux.

Comments (6)

Metnew avatar Metnew commented on May 2, 2024 3

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.

from suicrux.

Metnew avatar Metnew commented on May 2, 2024 2

@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.

from suicrux.

PharrellWANG avatar PharrellWANG commented on May 2, 2024

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

from suicrux.

Metnew avatar Metnew commented on May 2, 2024

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.

from suicrux.

PharrellWANG avatar PharrellWANG commented on May 2, 2024

@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?

from suicrux.

PharrellWANG avatar PharrellWANG commented on May 2, 2024

@Metnew Okay and I'll close this issue.

from suicrux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.