Open Swatinem opened 10 years ago
honestly, i wouldn't include translations into the build. i would actually have separate translation files and include only the one i need as a separate file. shouldn't be difficult with component-bundle
or something like it.
this is also why i do my templating server-side :P
by separate file you mean a <script>, right?
Well that would be good for local components. But what about published ones, ideally they should include translations, but still be as lightweight as possible by default. There are a lot of components out there that are pretty useless because they are specific to the english locale and don’t include translation support. See https://github.com/component/relative-date/pull/5, I totally forgot to create a PR for that back when I did it :-D
Looking at moment
for example, they really go the route of providing the locales as separate files: https://github.com/moment/moment/blob/develop/component.json
However that would conflict with other components doing the same thing.
hmmm do you have a suggestion on how to handle it? it would have to be a different property.
if you want to make your own plugin, you can try putting all the translations into a .translations
property or something then have a custom builder handle it.
Ye, maybe I can try that. But component install
also needs to correctly fetch those, similar to https://github.com/component/component/commit/5654ff623484753183c1f7a7fdd3122a318a3eea, haha
this should be possible when we merge @yields's builder pr?
i think the question is more whether it should be in the specs (translations, or, generally, optional deps/scripts/styles, etc). someone's going to have to implement it first though so we can judge.
we could just close this for now since this isn't something that would be going in soon
So what I want to achieve here is something like this:
Lets say you have a translation dictionary in all kinds of different languages ['en', 'de', 'hu', …]
It should be possible to compile
It does not need to be limited to languages. It might also be browser support, where we can compile separately one lean version for modern browsers and one fat (+50K) version for IE8 or something.
It might be a little related to #11, but for translations, it does not make sense to split them into separate packages.