Skip to content

[FEATURE]: Add the Ability to Ignore { } placeholders in strings when translatins  #484

@neilsilver

Description

@neilsilver

Its a common requirement when using i8n libraries to have Translations with placeholders for interpolation e.g. :

{ "key": "{{what}} is {{how}}" }

I'm suggesting having a option within the DEEPL provider which solves this problem with the following approach.

Add a usePlaceholders option to the translate method. This will determine whether placeholders should be wrapped in HTML tags before translation. Modify the logic to check this option and decide whether to wrap and strip HTML tags around placeholders.

If usePlaceholders is true, the placeholders are wrapped in HTML tags (...).
After translation, the HTML tags are stripped off to restore the original placeholder format.
If usePlaceholders is false, the placeholders are not modified, and the text is sent as-is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions