t macro with variable id extracted as message with undefined id
See original GitHub issueDescribe the bug
t({id: foo})
calls are being extracted with undefined
message id
#~ messages.po
#: src/path/file.tsx:##
msgid "undefined"
msgstr ""
To Reproduce
// src/path/file.tsx
import {t} from "@lingui/macro"
const foo = t`foo`
const Component = () => {
const text = t({id: foo})
return <span>{text}</span>
}
Expected behavior
No messages.po
changes
Additional context Dependencies
"@lingui/cli": "3.2.3",
"@lingui/loader": "3.2.3",
"@lingui/macro": "3.2.3",
"@lingui/react": "3.2.3",
"babel-plugin-macros": "2.8.0",
"react-scripts": "3.4.3",
"typescript": "3.9.7",
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Macro identifier undeclared even if it is declared
This comes up at the line where I am using someGetFunctionMacroB() in my code. variable = someGetFunctionMacroB();. But here is what ...
Read more >@lingui/macro - Reference — LinguiJS documentation
defineMessage macro is a wrapper around macros above which allows you to add comments for translators or override the message ID. Unlike the...
Read more >Master Macro Variables - by Examples
The macro-definition is a piece of a program that may contain complex logic including complete DATA and PROC steps, macro calls and macro...
Read more >How to use EVAL to Stop the Macro when there is no Next?
I run a js file that runs 2 macros, there is an If statement and a loop, the macro simply do a search...
Read more >Macros used in preprocessor directives should be defined ...
An attempt to use an undefined identifier may elicit a warning from the preprocessor. Or it may not; the preprocessor may simply assume...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t mind at all! Thank you for fixing it 👍
I see how I misused that API, however I’ve digged into the codebase a bit and found a fix for initial problem with undefined
msgid
s.Hope you don’t mind checking it out 😃