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.

Extraction in 3.15 completely wipes all strings using the t macro

See original GitHub issue

Describe the bug

When running extraction all strings using the t macro got wiped from my .po files.

To Reproduce

$ npx create-react-app ling
$ cd ling
$ npm i @lingui/macro @lingui/react @lingui/cli

add to package.json

"lingui": {
    "locales": [
      "en",
      "sl"
    ],
    "sourceLocale": "en",
    "format": "po",
    "rootDir": "./src",
    "catalogs": [
      {
        "path": "<rootDir>/locales/{locale}",
        "include": [
          "<rootDir>"
        ]
      }
    ]
  }

and to scripts: {
  "i18n:extract": "lingui extract --overwrite --verbose"
}
  
  
add to App.js

import { Trans, t } from '@lingui/macro'

<Trans>Test string using Trans macro</Trans>
{t`Test string using t macro`}


Run
npm run i18n:extract

This is the result:

#: App.js:21
msgid "Test string using Trans macro"
msgstr ""

#: App.js:22
msgid "{0}"
msgstr ""

Expected behavior

#: App.js:21
msgid "Test string using Trans macro"
msgstr ""

#: App.js:22
msgid "Test string using t macro"
msgstr ""

Additional context

Somehow the t string gets collapsed into the token {0}. It completely collapsed hundredths of strings in my project in the same way and I had to revert to 3.14.0

  • jsLingui version 3.15.0
  • Babel version @babel/core@7.20.2
  • Your Babel config: create-react-app - vanilla

Issue Analytics

  • State:open
  • Created 10 months ago
  • Reactions:6
  • Comments:5

github_iconTop GitHub Comments

1reaction
cravoleycommented, Nov 18, 2022

I got the same issue after upgrading from 3.13.3

0reactions
srcereresscommented, Dec 16, 2022

Same same! Pinning to 3.14.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · lingui/js-lingui - GitHub
extract translates passed file with includes import react-native-qrcode-svg ... Extraction in 3.15 completely wipes all strings using the t macro.
Read more >
How to Easily Extract From Any String Without Using VBA InStr
We use the VBA InStr function to get the position of the first space. We want to get all the characters before the...
Read more >
Re: st: macro string extraction - Stata
I want the local macro `first' to contain the string "h". ... however this function doesn't allow 1 1 (ones) as arguments (there...
Read more >
Nixpkgs 22.11 manual - NixOS
Nix expressions describe how to build packages from source and are collected in the nixpkgs repository. Also included in the collection are Nix...
Read more >
Reference - NeoMutt
-y, Start NeoMutt with a listing of all defined mailboxes. -Z, Open the first mailbox with new message or exit immediately with exit...
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