Skip to content

Slight change to placeholder variable causes loss of translation #2219

@vitexikora

Description

@vitexikora

Description

Changing a translation from eg.

t`Náhledový obrázek aplikace ${title}`

to

t`Náhledový obrázek aplikace ${title ?? '-'}`

Will destroy current translations like this:

+ #. placeholder {0}: title ?? '-'
#: src/modules/SoftwareTools/components/SoftwareToolsListItem/SoftwareToolsListItemBox.tsx
#: src/modules/SoftwareTools/components/SoftwareToolsListItem/SoftwareToolsListItem.tsx
+ msgid "Náhledový obrázek aplikace {0}"
+ msgstr ""

+ #: src/modules/SoftwareTools/components/SoftwareToolsListItem/SoftwareToolsListItemBox.tsx
+ #: src/modules/SoftwareTools/components/SoftwareToolsListItem/SoftwareToolsListItem.tsx
+ #~ msgid "Náhledový obrázek aplikace {title}"
+ #~ msgstr "Preview image of the {title} application"

Is this really intentional?

Verifications

  • I've checked the docs and this isn't covered there.
  • I've searched existing issues on GitHub.

Reproduction Steps

see Description

Expected Behavior

Changing an expression in the placeholder variable should not change translation key.
Maybe use the number index always, since the context is available in the comment.

Macro Support

SWC with @lingui/swc-plugin

Lingui Version

5.3.0

Babel Version

no babel

Framework

RsBuild + Typescript

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions