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

Skip to content

Escaped character shows up in end result #4973

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

Open
JPeer264 opened this issue Apr 22, 2025 · 0 comments
Open

Escaped character shows up in end result #4973

JPeer264 opened this issue Apr 22, 2025 · 0 comments
Labels

Comments

@JPeer264
Copy link

Which package?

[email protected] or @formatjs/[email protected] (later described why the "or")

Describe the bug

When using curly braces {{ }} they need to be escaped as far as I understood with a '. Usage: '{{somestring}}. However, when I pass the en.json with the escaped curly brace into the IntlProvider it shows up (see codesandbox below). As soon as I remove the messages in IntlProvider, the ' is gone (so the defaultMessage is changing the string correctly). So here I assume that messages really needs the final string, without the escaped character.

Now I am coming to the "or" from above. Here I am not sure what the expected input of IntlProvider should be. If it is with the ', then it is a bug in the react-intl (see en.json). If the expected input is without, then the formatjs compile (or maybe even the formatjs extract) has the wrong processing (this part is also included in the codesandbox).

To Reproduce

Codesandbox URL

https://codesandbox.io/p/devbox/zk8phk?migrateFrom=f26n8v

Reproducible Steps/Repo

Steps to reproduce the behavior:

react-intl:

  1. Go to index.jsx
  2. Remove the messages
  3. The ' is then gone and takes the correct defaultMessage

@formatjs/cli (just a showcase how I run it)

  1. Go to the terminal
  2. Execute npm run i18n:generate

Expected behavior

I would expect that with the following setup I would not see the ' in the message

+ Start editing to see some magic {{happen}}! (expected)
- Start editing to see some magic '{{happen}}! (actual)
@JPeer264 JPeer264 added the bug label Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant