Z
Z
Zimaell2019-12-17 15:23:51
Machine translation from one language to another
Zimaell, 2019-12-17 15:23:51

How to make the translator not touch the tags?

I use a translator script via PHP, a promt translator, it translates everything perfectly, but if there are tags in the text, then it either "eats" them or replaces them with something that is unnecessary, from which the text is distorted.
What do you think - what can be replaced with tags so that the translator does not react to them, and after the translation, replace them back?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Getmansky, 2019-12-17
@JimmDiGrizli

If the library you are using does not have the ability not to translate tags, then before translating, you can split the text into tags and translate in separate passages, and then assemble the document back with the translation attached to the tags. For this, you can use, for example, SimpleXML .
If you want to replace the tags, then you can try this method: - after replacing all the tags, translate the text and then restore the tags in the text. But the result here depends very much on the translation service. <div> -> <1><p> -> <2>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question