Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Example] Fix latest with-react-intl #16689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
simontaisne opened this issue Aug 29, 2020 · 2 comments · Fixed by #16692
Closed

[Example] Fix latest with-react-intl #16689

simontaisne opened this issue Aug 29, 2020 · 2 comments · Fixed by #16692

Comments

@simontaisne
Copy link

simontaisne commented Aug 29, 2020

Bug report

Describe the bug

The latest with-react-intl example #16215 has a few issues:

  • The extracted message ids don't match the ones produced in the .next cache. The compiled langs are therefore not used and default to the ones defined in the components.
{
  "65a8e": "Hello, World!",
}
__jsx("p", null, __jsx(react_intl__WEBPACK_IMPORTED_MODULE_1__["FormattedMessage"], {
    id: "N015Sp",
    defaultMessage: [{
      "type": 0,
      "value": "Hello, World!"
    }]
  }))
  • The translation happens only client side.

  • When navigating to a different page the locale is undefined and defaults back to en.

To Reproduce

  1. Install the latest with-react-intl example
  2. yarn build && yarn start
  3. Switch your browser language to French
  4. The messages are still the default ones (in English)
  5. Fix the ids in .next cache to match those in compiled-lang
  6. The messages are first rendered in English, then change to French client side
  7. Naviguate to another page, the messages are back to English

Expected behavior

  • Expect to have matching compiled ids
  • Expect to return compiled messages in SSR
  • Expect to keep the same locale when navigating

Screenshots

System information

  • Version of Next.js: 9.5.2
  • Version of Node.js: 14.7.0
@longlho
Copy link
Contributor

longlho commented Aug 29, 2020

Kk I'll take a look

@kodiakhq kodiakhq bot closed this as completed in #16692 Sep 1, 2020
kodiakhq bot pushed a commit that referenced this issue Sep 1, 2020
- Fix hashing algo for extraction so it's the same as babel config
- Fix locale persistence issue
fix #16689
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants