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

No compiled file output when catalogsMergePath specified #1315

Closed
AlexLeoTW opened this issue Dec 23, 2022 · 1 comment
Closed

No compiled file output when catalogsMergePath specified #1315

AlexLeoTW opened this issue Dec 23, 2022 · 1 comment

Comments

@AlexLeoTW
Copy link

AlexLeoTW commented Dec 23, 2022

Describe the bug
In the tutorial (https://lingui.js.org/tutorials/cli.html#preparing-catalogs-for-production) , catalogsMergePath is mentioned.
To my understanding, is option is for merge language catalogs into a single file.
Yet specifying this in lingui.config.js, causing no file output.

To Reproduce

  • Download this example (https://stackblitz.com/edit/github-qnfa4f)
  • modify lingui.config.js, adding catalogsMergePath option, like so:
    module.exports = {
      locales: ["en", "sv"],
      sourceLocale: "en",
      catalogs: [
        {
          path: "<rootDir>/locale/{locale}/{name}",
          include: ["<rootDir>/components/{name}"],
        },
        {
          path: "<rootDir>/locale/{locale}/{name}",
          include: ["<rootDir>/pages/{name}"],
        },
      ],
      catalogsMergePath: "<rootDir>/local/{locale}",
    };
  • run extract
    NODE_ENV=test npx lingui extract
  • run compile
    npx lingui compile --verbose

Expected behavior
should see compiled file:

locale
├── en
│   ├── _app.jsx.po
│   ├── index.jsx.po
│   ├── LangSwitcher.js.po
│   ├── two.jsx.po
│   └── en.js
└── sv
    ├── _app.jsx.po
    ├── index.jsx.po
    ├── LangSwitcher.js.po
    ├── two.jsx.po
    └── sv.js

Additional context
maybe something is missing after doMerge?
https://github.com/lingui/js-lingui/blob/a69ed8f713eb7f895158ea3b5f0ef99c26b63578/packages/cli/src/lingui-compile.ts#L82:L84

@Martin005
Copy link
Contributor

Martin005 commented Jan 16, 2023

Hello @AlexLeoTW, thank you for the report! I found out that your issue is a duplicate of #1233. I have identified where the issue is and will prepare a PR (#1341). Please follow the #1233 for more information 🙂

Futhermore, even after that issue is fixed, your setup won't exactly work currently. At the moment, Lingui replaces {locale} and {name} only once in the catalog paths as described in #1274 (I have prepared a PR that fixes that also – #1342).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants