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

Extract CLI prints "Missing message ID" warning when used with defineMessage() #1538

Closed
timomeh opened this issue Mar 20, 2023 · 4 comments
Closed

Comments

@timomeh
Copy link

timomeh commented Mar 20, 2023

Describe the bug
Running lingui extract prints "Missing message ID, skipping" to the console when you're passing the Message Descriptor from defineMessage() into i18n._().

Using defineMessage in combination with i18n._ is a documented pattern, see the macro usage in the docs. The extraction still works, but the output is making it look like there's an issue.

I think this was introduced in #1309, as part of the feature to also extract messages from i18n._() Edit: Looks like my suspicion was wrong. It also happens in 3.14.0. It doesn't happen in 3.13.3.

To Reproduce
Given this code:

import { i18n } from "@lingui/core"
import { defineMessage } from "@lingui/macro"

const foo = defineMessage({ message: "Foo" })

export default function App() {
   return <div>{i18n._(foo)}</div>
}

Run lingui extract. See logged output:

Missing message ID, skipping.
i18n._(foo)

Expected behavior
The logged warnings should not appear.

Additional context

  • jsLingui version: 3.17.2
  • Babel version: 7.17.5
  • Framework: Next.js with Babel
@andrii-bodnar
Copy link
Contributor

Hi @timomeh,

currently, we have the pre-released 4.0.0-next.2 version, could you please confirm if the issue is reproducible on this version?

to see all the changes in v4, please visit the releases page.

@timomeh
Copy link
Author

timomeh commented Mar 20, 2023

It doesn't show the log in 4.0.0-next.2 👍

@andrii-bodnar
Copy link
Contributor

andrii-bodnar commented Mar 20, 2023

@timomeh great! We are going to officially release the v4 version soon (it's a matter of a few weeks) so the fix won't be applied to the v3 version.

Probably, we can close this issue, what do you think?

@timomeh
Copy link
Author

timomeh commented Mar 20, 2023

Sounds totally reasonable, can be closed! Tried out v4 in our project and it seemed to work out of the box – besides the fact that it re-wrote all IDs due to the new autogenerated IDs 😬 I'll then just wait for v4 to be released

@timomeh timomeh closed this as not planned Won't fix, can't repro, duplicate, stale Mar 20, 2023
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