Angular 7 i18n support translate typescript file

201 Views Asked by At

Versions.

"@angular-devkit/build-angular": "0.13.4",
"@angular-devkit/build-ng-packagr": "0.13.4",
"@angular/animations": "7.2.2",
"@angular/cdk": "7.2.2",
"@angular/cli": "7.3.3",
"@angular/common": "7.2.6",
"@angular/compiler": "7.2.6",
"@angular/compiler-cli": "7.2.6",
"@angular/core": "7.2.6",
"@angular/forms": "7.2.6",
"@angular/language-service": "7.2.6",
"@angular/material": "7.2.2",
"@angular/platform-browser": "7.2.6",
"@angular/platform-browser-dynamic": "7.2.6",
"@angular/router": "7.2.6",

This is a support request: I started internationalizing my application, and I met the following problem: when generating the bundle for the Japanese locale (for example), with using i18n for .html file perfectly used but i can not using with .ts file. As far as I find out there are two ways, ngx-translate and @angular/localize.

Ngx-translate not suitable for my project, @angular/localize using start with angular 9 but i using angular 7.

Is there any way translate typescript file with angular 7 ? Or do I really have to upgrade to angular 9 to use @angular/localize

1

There are 1 best solutions below

1
On

Unfortunately yes.

The versions of the angular packages proceed the same as the main repo. The oldest version of the @angular/localize package goes back to 9.1.13.