1
0
Fork 0
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:
ultrox 2018-10-20 20:11:59 +02:00 committed by Tim Neutkens
parent e8c73b45fa
commit 2ce3f39585

View file

@ -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)