Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
neilsilver opened this issue Dec 20, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@neilsilver
Copy link

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.

@neilsilver neilsilver added the enhancement New feature or request label Dec 20, 2024
@neilsilver
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant