Istiak Mahmood
Istiak Mahmood

Reputation: 2422

translate on .ts File on Angular @ngx-translate

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?

Upvotes: 0

Views: 1008

Answers (3)

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)

Upvotes: 1

Onur Özkır
Onur Özkır

Reputation: 555

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')},
    ...
]

Upvotes: 2

CrisLizame
CrisLizame

Reputation: 1

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)

Upvotes: 0

Related Questions