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

Interpolation is too lazy #781

Closed
kaan-atakan opened this issue Feb 13, 2022 · 2 comments
Closed

Interpolation is too lazy #781

kaan-atakan opened this issue Feb 13, 2022 · 2 comments

Comments

@kaan-atakan
Copy link
Contributor

kaan-atakan commented Feb 13, 2022

Here is a simple example:

t(
  "key",
  { something: "something", somethingElse: "something else" },
  { default: "{{somethingElse}}" }
)

The result of the function call above is something when it should be something else. The correct value is returned when the data payload does not contain a shorter match:

t(
  "key",
  { aThing: "a thing", somethingElse: "something else" },
  { default: "{{somethingElse}}" }
)

This is almost certainly an issue with one of the regexes in interpolate@transCore, my attempts at fixing it myself have failed.

@kaan-atakan kaan-atakan changed the title Template substitution is too lazy Interpolation is too lazy Feb 13, 2022
kaan-atakan pushed a commit to kaan-atakan/next-translate that referenced this issue Feb 14, 2022
kaan-atakan pushed a commit to kaan-atakan/next-translate that referenced this issue Feb 14, 2022
kaan-atakan pushed a commit to kaan-atakan/next-translate that referenced this issue Feb 14, 2022
@kaan-atakan
Copy link
Contributor Author

I have created a pull request that fixes the issue

aralroca pushed a commit that referenced this issue Feb 14, 2022
* test for lazy interpolation (#781)

* fix lazy interpolation (#781)

Co-authored-by: Kaan Atakan <kaan@selfdecode.com>
@aralroca
Copy link
Owner

Thanks for your PR. Released on 1.3.4

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