0

I am working on a meteor-Angular project, where I am using @ngx-translate for translation.

Now when it comes to HTML files the translation works perfectly fine with a translation JSON file.

But when it comes to the ts file I do not know how to translate the words. Here is an example -

enter image description here

I have tried a lot how to translate .ts file but somehow I couldn't find a single solution to this problem. Does anyone know how to solve this problem?

Istiak Mahmood
  • 2,330
  • 8
  • 31
  • 73

3 Answers3

2

you can use the instant method in the component.

https://github.com/ngx-translate/core#methods

 this.column : [
    {header : this.translate.instant('ACCOUNT_TYPE')},
    {header : this.translate.instant('NAME')},
    ...
]

Onur Özkır
  • 559
  • 3
  • 12
1

you can look my answer

for currect working after f5 u need to use appInitializerFactory (don't forgot add it to providers like in answer)

0

you should translate when sending to HTML whit the pipe.

If the column is a FOR, also for each word use the pipe. ( column[0] | translate)