Multilanguage express app

后端 未结 3 1672
孤城傲影
孤城傲影 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:08

    The i18n-node is the simplest and greatest module that you should use. You can use directly in Javascript code or with Jade/Handlebar templates with express js.

    Why should you use i18n?

    • Auto detection of locale from the browser by header, cookie or query parameter depending on your setup.
    • It comes with examples as well.
    • It automatically generates a en.json by default inside ./locales/. This acts as a master file for you to start building new translations.
    • Supports Singular and plural forms
    • Support for parameters: __('Hello %s', 'Marcus') returns Hallo Marcus

提交回复
热议问题