Angular 6 and i18n in typescript

后端 未结 4 1042
半阙折子戏
半阙折子戏 2021-01-05 15:51

I saw that angular6 implements i18n for its components and that by using i18n you can internationalize your html but can you do the same with typescript? I have two specific

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-05 16:15

    In Angular 9 you can use global $localize function like this:

    $localize`String to translate`
    

    Be aware:

    1. In Angular 9 CLI does not extract these messages with the xi18n, you have to do it manually
    2. Run ng add @angular/localize if you have not gone through $localize migration

提交回复
热议问题