mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
fix(examples/with-react-intl): Bug when accept-language is anything other then 'en' (#5488)
package accept returns false if can't find language in offered list of languages, then later on bool is attempted to be split, and app crashes in prod & dev
This commit is contained in:
parent
e8c73b45fa
commit
2ce3f39585
|
@ -42,7 +42,7 @@ const getMessages = (locale) => {
|
|||
app.prepare().then(() => {
|
||||
createServer((req, res) => {
|
||||
const accept = accepts(req)
|
||||
const locale = accept.language(dev ? ['en'] : languages)
|
||||
const locale = accept.language(languages) || 'en'
|
||||
req.locale = locale
|
||||
req.localeDataScript = getLocaleDataScript(locale)
|
||||
req.messages = dev ? {} : getMessages(locale)
|
||||
|
|
Loading…
Reference in a new issue