aurelia / i18n

A plugin that provides i18n support.
MIT License
93 stars 70 forks source link

doc(webpack): instructions to bundle translations with webpack #271

Closed doktordirk closed 6 years ago

doktordirk commented 6 years ago

For the love of god, i couldn't get any of the instructions to use aurelia-i18n with webpack and i18n-xhr-backend/aurelia-loader to work. Nothing from here or the web worked for we. In contrast, using i18next-resource-store-loader was very simple and worked. Hence i propose to add to the docs the apparently much simpler alternative of using resources and i18next-resource-store-loader instead of backend and i18n-xhr-backend/aurelia-loader. Bundled translations are not a backend anyways.

zewa666 commented 6 years ago

Thanks @doktordirk. I want to make clear that this is neither an issue with i18next and definitely not with the Aurelia I18N plugin. It all boils down to the fact that per definition the backend approach is made exactly for the case of lazy loading translation files. What you're proposing is to upfront load all necessary resources. This might be ok but could lead to tremendous upfront loading times. There are various webpack focused plugins for i18next, like the one mentioned by you or this one.

Nevertheless all of them lack a proper chunking approach, and I agree that the whole webpack story is a complete mess. I'd wish Webpack would provide nicer solutions for these cases, like a SystemJS fallback for lazy loading.

In the meantime I guess your approach at least helps most of the users to get started and have a beginning point for tackling more specific scenarios.

May I ask to add just a note about the potential down-sides (upfront loading, not lazy) to your doc updates, so that we save ourselves of tons of non-framework-related questions?

doktordirk commented 6 years ago

Right! Better?

zewa666 commented 6 years ago

Yep I think that sounds good and certainly doesnt drive wrong expectations. If you could just fix the typo i'll merge this. Thanks also for taking care of mine ;)

doktordirk commented 6 years ago

fixed: will increases-> will increase

zewa666 commented 6 years ago

thanks @doktordirk