-
Notifications
You must be signed in to change notification settings - Fork 26
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
Translate string literals with programming logic #41
Comments
Hi @Juanca24691, thanks for the question. For tags like these you are best to use XML tag handling -- the DeepL API handles these tags carefully not to translate their content. We have an example translating Mustache templates in our Python library using this technique. That example might be useful to you. Summarised: you could parse the strings and replace the
would become:
Translate that string to Spanish with tag handling="xml", to get something like:
Then you can replace the tags with their original content:
I hope that helps, let me know if you have more questions. |
I have implemented it but Deepl adds extra characters that it shouldn't, for example XML tag closures sometimes add an extra closure like this /> or in some cases when there is a symbol like this | deepl adds one more || |
Currently I am developing a tool that extracts all string literals that are enclosed in double quotes from a file, the problem is that these string literals have programming logic as escape sequences and Deepl is not able to maintain that logic, this is an example of a string literal containing Russian characters that I want to translate into Spanish
"{ffffff}Дом {ffff00}№%d\n
{ffffff}Стартовая цена аукциона: {ffff00}%d BTC\n
{ffffff}Минимальная ставка: {ffff00}%d BTC\n
Завершение аукциона через: {ffff00}%s\n\n
{cccccc}%s - %d BTC\n\n
{ffffff}Укажите сумму вашей ставки:"
How should I approach this situation?
The text was updated successfully, but these errors were encountered: