Reputation: 2422
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 -
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
Reputation: 2084
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
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
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