Skip to content

DeepL accidentally translates number placeholder tag, breaking ICU italian translation #3330

@dkrizan

Description

@dkrizan

Describe the bug
When using DeepL provider for MT, the system incorrectly handles number placeholder tags added by Tolgee in Italian language (might apply for other languages though). Tolgee wraps number placeholders in:

<x id="tolgee-number"></x>

However, DeepL translates the value of the id attribute (e.g., tolgee-number → numero-tolleranza). Because of this, the resulting translated tag no longer matches the regex used to locate and replace number placeholder tags, causing the replacement to fail.

Example ICU message:

{amount, plural, one {Invite # member} other {Invite # members}}

Tolgee pre-processed:

{amount, plural, one {Invite <x id="tolgee-number">#</x> member} other {Invite <x id="tolgee-number">#</x> members}}

DeepL output:

{amount, plural, one {Invita <x id="numero-tolleranza">1</x> membro} many {Invitare i membri #} other {Invitare # membri}}

DeepL translates the id value, so the regex:

val TOLGEE_TAG_REGEX = "<x id=\"tolgee-number\">.*?</x>".toRegex()

no longer matches and the placeholder fails to be replaced.

To Reproduce

  1. Create a key using ICU with number placeholders (#).
  2. Add italian language
  3. Wait for MT translation from DeepL.
  4. Inspect the translated output.
  5. DeepL translates only the one plural form and modifies the tag’s id attribute, producing something like: Invita <x id="numero-tolleranza">1</x> membro

Expected behavior
Number placeholder tags should remain stable and matchable after translation. The translation provider should not modify the id attribute of <x> elements, or the prompt should enforce that attribute values remain unchanged.

Versions and environment

  • Tolgee Platform version: cloud

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions