funktionswerk / hapi-i18n

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

Hapi / Handlebars: languageHeaderField: 'accept-language' not working #22

Closed epochslee closed 5 years ago

epochslee commented 5 years ago

I have this plugin registered with 'accept-language'. The README suggests language but that does not detect the browser's language.

{
    plugin: require('hapi-i18n'),
    options: {
        locales: ['en', 'es'],
        directory: __dirname + '/locales',
        languageHeaderField: 'accept-language'
    }
}

How can I get my app to automatically use the right locale depending on the user's language set in their browser?

kaywolter commented 5 years ago

Browser language was not supported, yet. I have opened PR #23 to add it. Can you please check if the updates work on your end? I will merge the changes into master and publish a new release then.

kaywolter commented 5 years ago

PR is merged and new version 2.1.0 published to npm.