Skip to content

Commit

Permalink
fix: locale is in pageProps, not props
Browse files Browse the repository at this point in the history
  • Loading branch information
znarf committed May 15, 2018
1 parent 2c8f9f9 commit e6a8174
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/withIntl.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {Component} from 'react'
import {IntlProvider, addLocaleData, injectIntl} from 'react-intl'
import React, { Component } from 'react'
import { IntlProvider, addLocaleData, injectIntl } from 'react-intl'
import 'intl';
import 'intl/locale-data/jsonp/en.js'; // for old browsers without window.Intl

Expand Down Expand Up @@ -27,8 +27,8 @@ export default (Page) => {

// Get the `locale` and `messages` from the request object on the server.
// In the browser, use the same values that the server serialized.
const {req} = context
const {locale, messages} = req || window.__NEXT_DATA__.props
const { req } = context;
const { locale, messages } = req || window.__NEXT_DATA__.props.pageProps;

// Always update the current time on page load/transition because the
// <IntlProvider> will be a new instance even with pushState routing.
Expand Down

0 comments on commit e6a8174

Please sign in to comment.