Commit 2ce3f395 authored by ultrox's avatar ultrox Committed by Tim Neutkens

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
parent e8c73b45
...@@ -42,7 +42,7 @@ const getMessages = (locale) => { ...@@ -42,7 +42,7 @@ const getMessages = (locale) => {
app.prepare().then(() => { app.prepare().then(() => {
createServer((req, res) => { createServer((req, res) => {
const accept = accepts(req) const accept = accepts(req)
const locale = accept.language(dev ? ['en'] : languages) const locale = accept.language(languages) || 'en'
req.locale = locale req.locale = locale
req.localeDataScript = getLocaleDataScript(locale) req.localeDataScript = getLocaleDataScript(locale)
req.messages = dev ? {} : getMessages(locale) req.messages = dev ? {} : getMessages(locale)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment