Angular 9: i18n in TypeScript

后端 未结 3 772
悲&欢浪女
悲&欢浪女 2021-01-02 01:53

I studied the new i18n feature in Angular 9. https://angular.io/guide/i18n

How to translate text in TypeScript, e.g. SnackBar messages?

3条回答
  •  攒了一身酷
    2021-01-02 02:24

    The better way of translationId is:

    title = $localize`:@@Home.Title:Some title text`
    

    and you have to manually add it to your messages.xx.xlf (for example messages.fr.xlf and so on)

    
      Some title text
      TRANSLATION_HERE
    
    

提交回复
热议问题