Skip to content
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

Enabling ICU breaks interpolation #56

Closed
the-line opened this issue Nov 22, 2022 · 5 comments
Closed

Enabling ICU breaks interpolation #56

the-line opened this issue Nov 22, 2022 · 5 comments

Comments

@the-line
Copy link

the-line commented Nov 22, 2022

🐛 Bug Report

When ICU is enabled on i18next with react-i18next, some interpolations aren't executed. When .use(ICU) is commented out, the interpolation is working correctly.

To Reproduce

https://codesandbox.io/s/icu-interpolation-ix0cl3

Expected behavior

The text "User test has been created" is shown on the page.

Actual behavior

The text "User {{ what }} has been created" is shown on the page. Notice that the interpolation is not executed.

Your Environment

  • runtime version: Google Chrome 107.0.5304.107 and Mozilla Firefox 107.0
  • i18next version: i.e. 22.0.6
  • i18next-icu version: 2.0.3
  • react-i18next version: 12.0.0
  • react version: 18.2.0
  • intl-messageformat version: 9.13.0
  • os: Windows 11 22H2 (22621.819)
@adrai
Copy link
Member

adrai commented Nov 22, 2022

You used the wrong interpolation parenthesis...
for ICU it is: User { what } has been created instead of User {{ what }} has been created

@adrai adrai closed this as completed Nov 22, 2022
@the-line
Copy link
Author

the-line commented Nov 22, 2022

That was the problem! Thank you very much for your time to figure this out :)

Maybe mentioning in the documentation when using ICU that the i18next interpolation rules should not be used and only ICU interpolation rules will work.

@adrai
Copy link
Member

adrai commented Nov 22, 2022

That was the problem! Thank you very much for your time to figure this out :)

Maybe mentioning in the documentation when using ICU that the i18next interpolation rules should not be used and only ICU interpolation rules will work.

https://github.com/i18next/i18next-icu#advice

@the-line
Copy link
Author

Thanks again, and this was a nice case of "You should read the manual".

Sorry about that.

@the-line
Copy link
Author

I have changed the sandbox code to point this difference out for reference if someone find this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants