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

Load locale files at runtime #263

Open
JakobMiksch opened this issue Oct 28, 2021 · 2 comments
Open

Load locale files at runtime #263

JakobMiksch opened this issue Oct 28, 2021 · 2 comments

Comments

@JakobMiksch
Copy link
Collaborator

JakobMiksch commented Oct 28, 2021

when building the application, the locale files are transpiled to the built. Therefore they cannot be changed later on, like it is possible for the app-conf-*.json files.

useful links:

@JakobMiksch JakobMiksch changed the title Make locale files static Make locale files static Oct 28, 2021
@JakobMiksch JakobMiksch changed the title Make locale files static Load locale files at runtime Oct 28, 2021
@JakobMiksch
Copy link
Collaborator Author

Possible fix: replace require.context() in wegue/src/util/Locale.js (here and here) with a function that reads the files on demand. Maybe import is useful here.

@fschmenger
Copy link
Collaborator

@JakobMiksch This is the spot where all language files get picked up by webpack from the folder structure. As a second step the application and Wegue specific language files are merged into one big object.

Since one of the long term development goals is to separate Wegue and application code (e.g. deliver Wegue as a separate NPM package), IMO we should preserve the compile time packaging of Wegue core language files and only do dynamic loading for app language files.

The implementation steps are roughly as follows:

  • The code loading the app specific language files (here) should be replaced by a dynamic loader according to https://vue-i18n.intlify.dev/guide/advanced/lazy.
  • On the fly merge with the built-in Wegue language files should be executed after loading an app language file (implementation simliar to the deep merge in the existing code)
  • On application start both app language files for the fallback language and the current language have to be loaded.

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

2 participants