Another approach to Localization

Hello there,

I already did before a tutorial about localization and how i did it but i am trying to make it a little better this time and rethink it.

Basically my idea is to work with localized files/pages instead of simply replacing the string. This way one is much more flexible and can tailor content more precisely for different languages.

For core f7 it would be easy, just making the path in the routes array dynamic according to the current language selection.

But when using webpack, the outcome is a bit difficult because it packs everything into app.js so I got some questions:

  1. Does it make sense todo so? or should one simply work with replacing strings?
  2. How should one approach this? Can you make dynamic imports?
    import LandingPage from '../'+language+'/pages/landing.f7.html';

Webpack does support dynamic imports, it has different syntax https://medium.com/front-end-weekly/webpack-and-dynamic-imports-doing-it-right-72549ff49234

Oh that is great, then i will try that out. Would you recommend that approach?

I would use combined one, if page has totally different language related content, then use different route, otherwise strings replacing should be fine