-
Notifications
You must be signed in to change notification settings - Fork 69
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
Suggested support tool to minify XLIFFs #126
Comments
Hello Johan, Regards |
Hello Martin It is not the build process itself that we aim to optimise. It will be slower, but the minification of seven language files is done in a fraction of a second. However, even if it took significantly longer, the duration of the production build process is insignificant to us. We're currently minifying the XLIFFs on every build, but would really only need to for distribution/production builds if it was necessary to optimise development builds. Regarding removal of information, the minification does not affect the "normal" files used for "offline" translation, and we have not seen any tools which would allow a translator to translate the app at runtime. Our aim with the minification (as with the minification of the JavaScript) is to cut out everything not needed at runtime for the optimisation of the app's loading time, for example:
where the only thing really needed at runtime seems to be the
By minification of ~850 strings (expected to grow even further), we save >100 kB per language bundle, an opportunity the Angular team would probably jump at. The generated minified files are excluded from GIT using
To us this makes completely sense and we have only seen an upside with the approach so far. /Johan |
Forgot to mention that this would be another support tool / command, and not an option to |
@johannks, the XLIFF files are only used by the build process, they are not part of the output. When you build for a locale and supply an XLIFF file, the translations are applied during the build process. |
@GeorgDangl, in our setup (following the instructions in @ngx-translate/i18n-polyfill) it does get included into the As a matter of fact, I only just now noticed that ALL our 7 XLIFF files get included in the Are we doing something wrong? Is anyone else having the same issue? |
Oh, I see, the XLIFF is directly loaded for dynamic translations. I thought you'd create a separate bundle for Personally, I build a .json file for every language target with the strings I need and statically reference that during the build, so only the actual values (and their keys) are present, not the whole XLIFF. I can later take a look at how exactly I've implemented it. |
Hello Martin
Thanks again for an excellent tool. There is an option/functionality that we use which could be of interest to others as well. When we build a project, we have added a step to minify the XLIFF files to remove (what we think are) unnecessary tags.
We've added the following to a pre-build.js:
and are including the resulting *.min.xlf files (<50% size) instead of the original translated files in the build.
We have not run into any problems with this approach, and perhaps it could be a welcome addition to your package?
/Johan
The text was updated successfully, but these errors were encountered: