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

lingui extract to handle customized Trans component #2160

Open
ippeiukai opened this issue Jan 27, 2025 · 0 comments
Open

lingui extract to handle customized Trans component #2160

ippeiukai opened this issue Jan 27, 2025 · 0 comments

Comments

@ippeiukai
Copy link

Is your feature request related to a problem? Please describe.

I have a customized Trans component.
npx -- lingui extract does not extract messages from their direct usage.

import { Trans } from '~i18n';

Macro usage works fine. runtimeConfigModule is configured as follows:

  runtimeConfigModule: {
    i18n: ['~i18n', 'i18n'],
    Trans: ['~i18n', 'Trans'],
  },

Describe proposed solution

lingui extract should support Trans component imported from other locations than hardcoded @lingui/react.

In addition to Trans from @lingui/react, lingui cli can pick up runtimeConfigModule.Trans or something similar from config file.

Describe alternatives you've considered

lingui extract could pick up any <Trans /> usage regardless of import path, like it does with i18n._(). It would break backward compatibility, however.

Additional context

@lingui/react is hardcoded here:

.referencesImport("@lingui/react", "Trans")

Is runtimeConfigModule ignored by lingui-macro plugin when ran from lingui extract cli?

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

1 participant