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

Fix escaped backticks in macro-transformed template strings #477

Merged
merged 2 commits into from
Mar 21, 2019
Merged

Fix escaped backticks in macro-transformed template strings #477

merged 2 commits into from
Mar 21, 2019

Conversation

ackwell
Copy link
Contributor

@ackwell ackwell commented Mar 20, 2019

To use a literal backtick in a template string (such as for markdown code blocks), it needs to be escaped (const str = `\``;).

Unfortunately, this gets picked up as \\` due to value.raw, which ends up as a literal \` in the translation string.

In turn, this leads to final translation strings ending up with the literal \` , which is broken syntax, throwing a Error: Can't parse message. Please check correct syntax".

This PR provides a quick fix for the issue, allowing backticks to be used.

@codecov
Copy link

codecov bot commented Mar 21, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@0e673f5). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #477   +/-   ##
=========================================
  Coverage          ?   91.09%           
=========================================
  Files             ?       51           
  Lines             ?     1415           
  Branches          ?        0           
=========================================
  Hits              ?     1289           
  Misses            ?      126           
  Partials          ?        0
Impacted Files Coverage Δ
packages/macro/src/js.js 99.25% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0e673f5...2fd1030. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented Mar 21, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@0e673f5). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #477   +/-   ##
=========================================
  Coverage          ?   91.09%           
=========================================
  Files             ?       51           
  Lines             ?     1415           
  Branches          ?        0           
=========================================
  Hits              ?     1289           
  Misses            ?      126           
  Partials          ?        0
Impacted Files Coverage Δ
packages/macro/src/js.js 99.25% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0e673f5...2fd1030. Read the comment docs.

@tricoder42 tricoder42 merged commit e1bfbf7 into lingui:master Mar 21, 2019
@tricoder42
Copy link
Contributor

It looks mostly harmless.

Good job! 👍

@ackwell ackwell deleted the fix-backticks branch March 22, 2019 01:10
@tricoder42
Copy link
Contributor

Released in v2.8.0

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

Successfully merging this pull request may close these issues.

2 participants