question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

t macro with variable id extracted as message with undefined id

See original GitHub issue

Describe 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:closed
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
tricoder42commented, Dec 15, 2020

I don’t mind at all! Thank you for fixing it 👍

1reaction
amankkgcommented, Dec 15, 2020

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 msgids.

Hope you don’t mind checking it out 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found