Skip to content

Conversation

@stenin-nikita
Copy link
Contributor

I made a fix that correctly handles the extraction of descriptions wrapped in template string literals. The current behavior was resulting in the generation of an incorrect identifier. This pull request fixes this issue.

// source
<FormattedMessage
  defaultMessage="Hello, World!"
  description="Greeting message"
/>
<FormattedMessage
  defaultMessage="Hello, World!"
  description={`Greeting message`}
/>

// transformed
_jsx(FormattedMessage, {
    id: "Ae/S0P"
});
_jsx(FormattedMessage, {
    id: "N015Sp",
    description: "Greeting message"
});

@changeset-bot
Copy link

changeset-bot bot commented Jul 13, 2025

🦋 Changeset detected

Latest commit: a76b209

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@swc/plugin-formatjs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@CLAassistant
Copy link

CLAassistant commented Jul 13, 2025

CLA assistant check
All committers have signed the CLA.

@kdy1 kdy1 changed the title fix(formatjs): fix description extract for the template literal string fix(formatjs): Fix description extract for the template literal string Jul 16, 2025
Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated it to make it more efficient :)

@kdy1 kdy1 enabled auto-merge (squash) July 16, 2025 06:09
@kdy1 kdy1 merged commit 9a27285 into swc-project:main Jul 16, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants