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?
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')},
...
]
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)
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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.