Search code examples
javascripthtmlangulartypescriptlocalization

Localization Angular 9 Medium size application


We have developed an application in Angular 9 (Only English words), Now we need to support Spanish language as well. all labels and headings are defined in HTML pages. is there any way Can I convert all pages to Spanish with out creating / reading constant files (entering all headings and labels in constant .ts or JSON file)

I see ngx-translate but I see it's using constant files and reading it. (https://stackblitz.com/github/ngx-translate/example?file=src%2Fapp%2Fapp.module.ts)

If I need to follow the same, I need to create each page (Our application has 100 pages approx) data in JSON and read from it.

Please suggest if there is any easy solution to convert or suggest best way to implement it.

Thank you in advance.


Solution

  • the best way would still be creating a json file for each language and read from it. it helps you extends more language, for example some day you need french, japness, hindy, chinese...

    by the way ngx-translate seems outdated, there is also transloco, which works great