Search code examples
node.jsangulartypescripttransactionsngx-translate

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?


Solution

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