How can I get the browser language in node.js (express.js)?

前端 未结 4 1330
执笔经年
执笔经年 2020-12-08 02:16

User requests some page and I want to know (on server side) what is the language in his/her browser. So I could render template with the right messages.

On clie

4条回答
  •  死守一世寂寞
    2020-12-08 02:54

    You can use req.headers["accept-language"] to get the language/locale the user has set in his browser.

    For easier support, you may want to look into a locale module.

提交回复
热议问题