Closed rhagigi closed 8 years ago
I disagree. For one, what if you have multiple routes needing different default languages or supporting different languages? Second, using module caching as your instance creation and config mechanism is an anti pattern as an npm module... You may be used by other modules that may want to set their own defaults/supported languages... Now that would bleed into any apps using those modules.
Hi @tinganho - I seem to have been caught out by this... I'm using this module in 2x places and passing in an array of supported languages in each case. In each of the 2x places, the supported languages are different. However, the issue is that I can only have one configuration of support languages, causing me some issues.
How can I fix this?
Is there any issue in doing this in each file I need to support a set of different languages?
const acceptLanguage = require('accept-language').create();
@chearmstrong that should do what you want.
Great, thanks.
They shouldn't use it. It accidentally got exported.