Search code examples
angularngx-translateangular-aot

Ngx translate aot compilation: changing translation in production code


I would like to compile my angular application aot. My translations are saved on the server in a database. These translations can be changed by the users. So is there any way to get these changes to work with the aot compilation if a user changed the translation?


Solution

  • The benefit of AOT compilation is that

    • the bundle doesn't need to contain the template compiler anymore, making it much smaller.
    • HTML templates are precompiled, making the application start much faster since templates don't need to be compiled at startup in the browser
    • since the AOT compiler compiles to TypeScript first, it allows detecting errors in your template at build time that would be only detected at runtime with JIT, or wouldn't be detected at all.

    All this is very useful, but has nothing to do with ngx-translate. ngx-translate is just a pipe, a service and a directive allowing to translate keys into values, at runtime.