I'm a great fan of the i18n process shipped with Angular 2+, in particular the following two features:
- The ability to generate translation files out of annotated HTML templates using a CLI command (ng xi18n).
- The ability to replace template texts with their translations at build time (saving up resources at runtime).
Now I'm working on a non-Angular project and would like to implement an i18n process similar to the one described above. The project is based on AngularJS and uses custom Webpack bundling. HTML template files are currently loaded with Webpacks raw loader and bundled as strings.
Webpack itself suggests concatenating its HTML and i18n loaders. While this would probably solve (2), it doesn't tackle (1) and the syntax required in the templates would be pretty far away from the one used in Angular (i.e. adding i18n="" attributes to elements that have to be translated).
Does anyone have experience with this kind of problem? Is there a way to use a specialised Webpack loader for this use case or maybe even a tiny part of the Angular 2+ build system?