-
-
Notifications
You must be signed in to change notification settings - Fork 317
Description
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
- Create a key using ICU with number placeholders (
#). - Add italian language
- Wait for MT translation from DeepL.
- Inspect the translated output.
- DeepL translates only the
oneplural 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