Temporary removal of HTML from string for Google Translate API to reduce cost

為{幸葍}努か 提交于 2019-12-02 03:49:35

Haha, I also had that problem. But it has been while ago...

I think, there was a problem were - due to translation-nature - some sentenceparts were swaped. So I was not able to fit the tags in at the same position, first. But I think there was a way to get some metadata from the translationprocess, were you can see which part of the sentence have moved to a new position and what the content was... I know, I solved it finally. But I cant recall how :(

If every word takes the same place again after translation, you could first separate all words by whitespace OR htmltag into an array and remember where each HTML-tag was and reapply that after translation...

Add google translate service to your website and add notes witch words not to translate.

https://translate.google.com/manager/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!