Angular 6 and i18n in typescript

后端 未结 4 1043
半阙折子戏
半阙折子戏 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:08

    You can use the Transloco library to do this: https://ngneat.github.io/transloco/.

    And then get the translations in the Typescript file like so:

    this.translocoService.translate('hello');
    

提交回复
热议问题