How to use comments with i18n._()? #1381
-
How do I have a comment extracted into the .po file using I have tried: i18n._({
id: "Code",
message: "Code",
comment: "2 or 3 letter abbreviation",
}) However, I'm getting errors such as the following:
I feel like I'm missing something incredibly obvious. (not using the extraction macros in this codebase as babel macros are incompatible with NextJS swc compiler) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
You can use SWC plugin. https://github.com/lingui/swc-plugin Using linguijs without a macros is discouraged. |
Beta Was this translation helpful? Give feedback.
-
What about your code snippet it doesn't work because it should be either: // supposed for "manual" usage, extractor would match i18n._ call expression
i18n._("Code", {
message: "Code",
comment: "2 or 3 letter abbreviation",
}) or // This is generated by macro,
// note the /* i18n */ comment. Object Expression following this comment would be
// treated and extracted as a message descriptor (no matter what fn it was passed to)
i18n._(/*i18n*/{
id: "Code",
message: "Code",
comment: "2 or 3 letter code for an event"
}) |
Beta Was this translation helpful? Give feedback.
You can use SWC plugin.
https://github.com/lingui/swc-plugin
Using linguijs without a macros is discouraged.