funktionswerk / hapi-i18n

Translation module for hapi based on mashpie's i18n module
MIT License
39 stars 22 forks source link

support http header `Accept-Language` #4

Closed jney closed 8 years ago

jney commented 8 years ago

could the plugin support Accept-Language and have appropriate Content-Language in the response ?

ie:

curl -i 0.0.0.0:3333/hello -H 'Accept-Language: fr'

HTTP/1.1 200 OK
content-language: fr

salut
jney commented 8 years ago

for info:

req.i18n.locale // "fr"
req.i18n.getLocale() // "en"
codeva commented 8 years ago

Did you have a look at https://github.com/ozum/hapi-locale? This plugin supports the extraction of the locale from the request header.