banana-i18n
banana-i18n copied to clipboard
Write a webpack loader that prepares message files in single json file after resolving fallbacks
.. So that we don't need to load multiple json files to browser
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.
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.
It might be better to make it a grunt plugin instead as grunt is more universal. Already, this repo is no longer using webpack.
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.