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

I try to ignore the <svg> code but no luck. #21

Open
marcwales opened this issue Feb 19, 2025 · 3 comments
Open

I try to ignore the <svg> code but no luck. #21

marcwales opened this issue Feb 19, 2025 · 3 comments

Comments

@marcwales
Copy link

Hi,

I'm using google sheet to translate my shopify csv files but i'm facing different issues :
1 - The html code is counted as a character even if it's not translated. Exemple : <a href:"http://websiteurl.com" target:"_blank">Hi is counted as 40+ characters instead of 2.
2 - When translating to german, all the decimal (.) are translated to commas (,). Even in code like "<path d="M111.4 295.9c-3.5" it becomes
"<path d="M111,4 295,9c-3,5" which messes up everything.

Here is what i've tried :

  • <path translate="no" this does not stop the word count or the comma problem.
  • =DeepLTranslate(H2;"en";D2;{"tag_handling", "xml"; "ignore_tags", "svg"}) this gives me an error.

If i can add this ignore parameter directly in the scrip i've copied from your doc that would be awesome but i don't know how. I can see this param inside the code :

  • @param {cell range} options Optional. Range of additional options to send with API translation
  • request. May also be specified inline e.g. '{"tag_handling", "xml"; "ignore_tags", "ignore"}'

Hope you can help me.

Regards,

@JanEbbing
Copy link
Member

Hi, if you send a normal translation request, all characters will be billed. You likely want to use what we call "Tag handling", see docs.

From the README, I think what you want is (this would translate from english to german):

=DeepLTranslate(H2,"en","de",,{"tag_handling", "html"; "ignore_tags", "svg"})

If that doesn't work:

=DeepLTranslate(H2;"en";D2;{"tag_handling", "xml"; "ignore_tags", "svg"}) this gives me an error.

Please provide the exact error message.

1 - The html code is counted as a character even if it's not translated. Exemple : <a href:"http://websiteurl.com/" target:"_blank">Hi is counted as 40+ characters instead of 2.

Which command are you using to translate this? With tag_handling set to xml or HTML tags don't get counted, otherwise they will

2 - When translating to german, all the decimal (.) are translated to commas (,). Even in code like "<path d="M111.4 295.9c-3.5" it becomes "<path d="M111,4 295,9c-3,5" which messes up everything.

This is how numbers get displayed in German (I do agree we should provide an option for localized formats like this though). You can use ignore tags to turn off translation for those segments.

@marcwales
Copy link
Author

Hi Jan,

Thank you for your return. I've tried your solution but it gives me an error. I cannot use the comma on google sheet, it has to be semi-colon like this :
=DeepLTranslate(H2;"en";"de";{"tag_handling"; "html"; "ignore_tags"; "svg"})

And when i do this, it says the following :
Error: Bad request, message: Value for 'glossary_id' not supported. (ligne 189).

Do you know a way arround this ?

@JanEbbing
Copy link
Member

glossaryId is the 4th argument, hence we have the 2 commas in the original call, so you would need to try

=DeepLTranslate(H2;"en";"de";;{"tag_handling"; "html"; "ignore_tags"; "svg"})

But I'm not sure you can pass dictionaries like this as the options argument (in our example code semicolons separate key value pairs and commas separate keys and values.)

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

No branches or pull requests

2 participants