Skip to content

Skip strings already wrapped in t() or <Trans> #2

Description

@idomy

Problem

On a partly-internationalized app, extract re-grabs text that is already inside a t("...") call or a <Trans> element. Those should not be extracted again.

Proposal

In the extractor, skip:

  • string literals that are arguments to t(...) / i18n.t(...)
  • JSX text inside <Trans>...</Trans>

Acceptance criteria

  • A fixture containing both t("Hello") and a bare <p>Hello</p> extracts only the bare one.
  • The existing demo fixture still extracts 11 strings (no regressions).

Pointers

  • src/extract.mjs -> renderContext() and the StringLiteral / JSXText visitors.
  • Add the new fixture under examples/.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions