@lingui/core i18n._(/* i18n */ `Sign in`) when running lingui extract isn't picked up
Describe the bug
We're not using the @lingui/macro and are using bare @lingui/core and @lingui/react. We're using it in combination with nextjs.
To handle string translations we use i18n directly (for example for
i18n._(/* i18n */ `Sign in`)
However, when running lingui extract it doesn't pick up the translations.. It used to work, but somewhere in the last few months it stopped working.
It seems that it has to do with the backticks, if I replace it with regular quotes, it does work:
i18n._(/* i18n */ 'Sign in')
To Reproduce Create a translation with backticks like so:
i18n._(/* i18n */ `Sign in`)
Expected behavior
I would expect backticks to work.
Additional context
I've replaced all backticks with regular quotes, so that solves the issue for us for now :)
Will take a look to everything you opened mate asap, before the end of this week it will be solved. Srry for the inconveniences.
@semoal We've got workarounds in place, so no rush :)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Not stale
Hello @paales! Do you remember which version of lingui packages you used? I tried the following version but the extraction worked:
- [x] 3.15.0
- [x] 3.14.0
- [X] 3.13.3
- [X] 3.13.2
- [X] 3.13.1
- [X] 3.13.0
- [X] 3.12.1
BUT
I found that we are not putting the line number to the PO file if you use backticks ` in the i18n._() call.
{i18n._(/* i18n */ `Home`)}
{i18n._(/* i18n */ "Account")}
outputs
#: src/App.tsx:9
msgid "Account"
msgstr "Account"
#: src/App.tsx:
msgid "Home"
msgstr "Home"
This maybe relates to your issue 🙂 Were you pre-processing or post-processing the output files?