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

Bug: brackets in template literal results in macro compile failure #1303

Closed
bright-wang opened this issue Nov 22, 2022 · 1 comment · Fixed by #1328
Closed

Bug: brackets in template literal results in macro compile failure #1303

bright-wang opened this issue Nov 22, 2022 · 1 comment · Fixed by #1328
Assignees
Labels

Comments

@bright-wang
Copy link

Describe the bug
Just very similar to #1075, I also came up with compile failure error:
Error: Can't parse message. Please check correct syntax: "input variable: { ...... }"

Messageformat-parser trace: Expected identifier but "." found.
at compile (....../node_modules/.pnpm/@lingui+cli@3.13.3_l57gh7u5ywadp5ivckxo6hsz4m/node_modules/@lingui/cli/api/compile.js:115:11)
at compileSingleKey ....../node_modules/.pnpm/@lingui+cli@3.13.3_l57gh7u5ywadp5ivckxo6hsz4m/node_modules/@lingui/cli/api/compile.js:42:49)
at ....../node_modules/.pnpm/@lingui+cli@3.13.3_l57gh7u5ywadp5ivckxo6hsz4m/node_modules/@lingui/cli/api/compile.js:70:12

To Reproduce
Steps to reproduce the behavior, possibly with minimal code sample, e.g:

import { t } from '@lingui/macro';

export default function App() {
   return <input placeholder={t`input variable: { ...... }`} />
}

Expected behavior
Template should be compiled with no error...

Additional context
Package version info:
'@lingui/cli': 3.13.3_l57gh7u5ywadp5ivckxo6hsz4m
'@lingui/macro': 3.13.3_fxhud3nu6zrc5fvtlhahzizpp4

@timofei-iatsenko
Copy link
Collaborator

timofei-iatsenko commented Jan 11, 2023

Fixed and would be published with next version. You probably need to escape brackets with ' otherwise they would be treated as placeholder expansion (this is according to spec)

Hello, '{...}'

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

Successfully merging a pull request may close this issue.

3 participants