i18next / i18next-express-middleware

[deprecated] can be replaced with i18next-http-middleware
https://github.com/i18next/i18next-http-middleware
MIT License
207 stars 55 forks source link

Add optional "lookupHeader" to replace default header #179

Closed Dominic-Preap closed 5 years ago

Dominic-Preap commented 5 years ago

Can we have optional "lookupHeader" to replace default header "Accept-Language"?

i18next
      .use(FilesystemBackend)
      .use(i18nextMiddleware.LanguageDetector)
      .init({
        detection: {
          order: ['header', 'querystring'],
          lookupQuerystring: 'lng',
          lookupHeader: 'x-language'
        },       
      });
jamuhl commented 5 years ago

feel free to provide a PR taking value from options: https://github.com/i18next/i18next-express-middleware/blob/master/src/languageLookups/header.js#L12 and default to the "Accept-Language" if not set

Dominic-Preap commented 5 years ago

@jamuhl would you be able to review my PR?

Dominic-Preap commented 5 years ago

@jamuhl Would you mind update this option in README.md? Thanks.

jamuhl commented 5 years ago

@Dominic-Preap was added to readme - thank you for the reminder...