Internationalization with Angular 4

后端 未结 4 863
有刺的猬
有刺的猬 2020-12-10 17:01

I need to Add multiple language support for my Angular 4 Application.I need to know the best approach to achieve this.

4条回答
  •  粉色の甜心
    2020-12-10 17:19

    You can use ngx-translate which is the standard library for internationalization in Angular 2+

    You can import the library and create a set of json files which contains the translations and put it inside the assets folder.

    Then you can refer it in the HTML. say for example.

    en.json has,

    "guest.first-name": "first Name",
    

    where first one is the key and second is the value to be displayed . and you can refer in the html as,

      
    

提交回复
热议问题