How it works...
Currently, the only way to do JIT compilation for localization in Angular is to eject your project from Angular-CLI. This has some additional complexity and overhead to it, but it gives us the customization options we need in WebPack to enable this functionality. Future versions of Angular will support JIT language compilation as an add-on in Angular-CLI.
After ejecting, we configure WebPack to support loading language templates as raw modules in our build system. This lets us load the specific language file that we need when the client first loads Angular. We get those files into Angular through our custom i18n-provider. This provider may look complicated, but all it's doing is registering a promise with Angular's launch ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access