gatsby-plugin-intl icon indicating copy to clipboard operation
gatsby-plugin-intl copied to clipboard

Value for intl.Locale is Incorrect on Build (SSR)

Open jhoffmcd opened this issue 5 years ago • 2 comments

After the latest update, I noticed that on SSR builds yarn build the value for intl.locale is incorrect.

CodeSandbox https://codesandbox.io/s/gatsby-starter-default-fx5gw?fontsize=14

The setup is I have two languages: [en-us, es-es]. The default language is set to en-us. Everything works as expected in development mode yarn develop. However, running yarn build and logging out the value of intl.locale from either useIntl or injectIntl shows that durring the SSR pass on the build, the value is incorrect.

Expected

intl.locale value is: en-us
intl.locale value is: es-es

Actual

intl.locale value is: en-us
intl.locale value is: en

It's worth noting that the new version of react-intl sets a defaultLocale if one is not created. See related PR #80

jhoffmcd avatar Nov 02 '19 23:11 jhoffmcd

This issue seems to somehow not occur with node 13.x ( works with 13.1.0 at least), as far as I have tested. It was definitely occuring on Node 12.x So upgrading (if possible) might solve the problem for you.

pierreavizou avatar Jan 27 '20 14:01 pierreavizou

I can confirm a problem on node 12.

jepek avatar Jan 31 '20 06:01 jepek