banana-i18n icon indicating copy to clipboard operation
banana-i18n copied to clipboard

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

Open santhoshtr opened this issue 4 years ago • 4 comments

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

santhoshtr avatar Oct 29 '19 14:10 santhoshtr

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.

stephanebisson avatar Feb 26 '21 13:02 stephanebisson

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 avatar May 13 '21 13:05 siddharthvp

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

siddharthvp avatar May 13 '21 13:05 siddharthvp

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.

santhoshtr avatar May 13 '21 14:05 santhoshtr