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

Write a webpack loader that prepares message files in single json file after resolving fallbacks #23

Open
santhoshtr opened this issue Oct 29, 2019 · 4 comments

Comments

@santhoshtr
Copy link
Member

.. So that we don't need to load multiple json files to browser

@stephanebisson
Copy link

That would be great.

I played around with the idea here after seeing that the repeated msg keys were actually taking a lot of space in the application bundle.

I was able to shave off over 50% by deduplicating msg keys and ignoring "@metadata" and "qqq.json". However, once everything is gzipped, the difference is much less significant.

@siddharthvp
Copy link
Collaborator

I was able to shave off over 50% by deduplicating msg keys and ignoring "@metadata" and "qqq.json". However, once everything is gzipped, the difference is much less significant.

It looks like what you've done is to put messages for all languages in a single file – which doesn't scale for projects with a lot of messages.

I think what this task is about is creating different json file for every language but after including in them the fallback language messages, in this format: https://github.com/wikimedia/banana-i18n#load-the-messages-for-many-locales-at-once. This would indeed save quite a bit of data as well reduce number of network requests needed.

@siddharthvp
Copy link
Collaborator

It might be better to make it a grunt plugin instead as grunt is more universal. Already, this repo is no longer using webpack.

@santhoshtr
Copy link
Member Author

My attempt on this https://github.com/santhoshtr/banana-i18n-loader
It may not be ready for a production usage. It just illustrate the concept.

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

No branches or pull requests

3 participants