formatjs / formatjs

The monorepo home to all of the FormatJS related libraries, most notably react-intl.

Home Page:https://formatjs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Quoting / Escaping does not work correctly with multiple interpolations

jarvispact opened this issue · comments

Which package?

react-intl

Describe the bug

The documentation about quoting / escaping here states the following: A single apostrophe escapes one syntax character immediately following it

So i would expect the following behaviour:

  • Hello {firstname} {lastname}
    • expected: Hello Tony Stark
    • actual: Hello Tony Stark
  • Hello '{firstname} {lastname}
    • expected: Hello {firstname} Stark
    • actual: Hello {firstname} {lastname}
  • Hello '{firstname}' {lastname}
    • expected: Hello {firstname} Stark
    • actual: Hello {firstname} Stark

To Reproduce

Codesandbox URL

Link

Screenshots

image

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser Chrome
  • Version 120.0.6099.201 (Official Build) (64-bit) (cohort: Control)

hmm the codesandbox link just points to a new codesandbox. Can u fix that?

Based on the example above, the issue seems to be in the docs. Our behavior is consistent with ICU's escaping behavior so I'll update the docs so say so.

Screenshot 2024-01-15 at 10 47 38 PM

I saw the documentation on the website updated already. Thanks for the clarification.