Multilanguage express app

后端 未结 3 1648
孤城傲影
孤城傲影 2021-01-31 04:15

I wonder what would be the best way to implement multiple versions / languages of the same content in the same layout in express.

Should I just do this?

         


        
3条回答
  •  情深已故
    2021-01-31 05:17

    I would suggest to keep only one template, as if you use one template per language it will get out of hand very quickly, let alone duplicate much content (and the small amount of "logic" you would put in a template too). Many applications use a tool called gettext to do the internationalization thing. There is a node.js library for it at https://github.com/DanielBaulig/node-gettext

    Alternatively there is also i18n-node. It appears to have a bit more integration with express js.

提交回复
热议问题