【发布时间】:2020-01-14 19:14:22
【问题描述】:
你好,这是我的代码,你可以从这里理解整个问题
<?php
require_once ('vendor/autoload.php');
use \Statickidz\GoogleTranslate;
$source = 'en';
$target = 'hi';
$text = "<p>This is a test equation <span translate='no' class='math-tex notranslate'> test me \(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)</span>to check something<span class='math-tex notranslate'>\(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)</span></p><p>test</p><p>test</p><p>test</p>";
$trans = new GoogleTranslate();
$result = $trans->translate($source, $target, $text);
echo $result;
?>
<html>
<p>
<br/>
=============== THIS IS THE ORIGINAL TEXT =================
<br/><br/>
This is a test equation <span class='math-tex notranslate'>\(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)</span>to check something<span class='math-tex notranslate'>\(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)</span></p><p>test</p><p>test</p><p>test</p>
</html>
<script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=default'></script>
当我从英语印地语翻译文本时,一切都很好,但我的 数学方程有问题。它应该像它一样工作。我已经添加了 现场版在这里http://ynapsweb.site/pro/test/ 请让我 知道我哪里做错了。
如果我得到答案,我也想解决这个问题,我会在这里发布。
【问题讨论】:
标签: google-translate mathjax google-translation-api