Ignore charactère to translation

Hello, I want to translate a text containing emojis but the api translates them, is there not a way that the api can ignore characters, ie place them without translating them, for example: “hello :joy:” → “bonjour :joy:” but LibreTranslate translate “Bonjour.” or sometimes introduces the name of the emoji in the text…

Thanks for your future answer :smiley:

As a workaround, you could wrap emojis in <span> tags and use format: html in the API request:

hello <span>😋</span>

Bonjour. <span>😋</span>

Then remove the <span> tags.

I wonder if there’s a better way where emojis could be automatically wrapped in tags when format is set to text.

1 Like

Thank you for your answer! I’m going to use this, I think it’s fantastic to find such a powerful translation tool in open source and so I thank you for what you do :heart:

2 Likes

We should pass emojis through if they’re not in the dataset, but if they are we try to translate them like any other token. It’s not clear which is a better strategy, and whether users would generally want emojis intact or included in the context of the translation and possibly modified. The span trick is good for explicitly maintaining sections of text though.