From 2ce3f395859903b4a9b587f268003bc375325737 Mon Sep 17 00:00:00 2001 From: ultrox Date: Sat, 20 Oct 2018 20:11:59 +0200 Subject: [PATCH] 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 --- examples/with-react-intl/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/with-react-intl/server.js b/examples/with-react-intl/server.js index 30199df9..84441798 100644 --- a/examples/with-react-intl/server.js +++ b/examples/with-react-intl/server.js @@ -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)