google-translate 相关问题

Google翻译是Google Inc.提供的付费统计机器翻译服务,用于将部分文字,文档或网页翻译成其他语言。

添加 Google 翻译后无法编辑 SharePoint 页面

添加 Google 翻译后,我无法编辑 SharePoint 页面。 我遇到了以下错误。 以下是 SPFx React Web 部件中使用的 googleTranslateElement 的代码片段。 常量

回答 1 投票 0

如何禁用谷歌翻译原文工具提示

我在我的网站中使用谷歌翻译作为语言转换器,但它显示了名为“原始文本”的恼人的工具提示。我如何禁用此功能以及任何其他更好的想法/工具/API 来执行此操作? T...

回答 6 投票 0

Google 翻译 API 示例

我想在eclipse中使用Google Translate API,我已经检查了Google API网站,但是没有任何Java中的Google Translate API的示例代码。有人可以提供一些并解释一下吗...

回答 3 投票 0

如何判断机器翻译系统的质量?

我知道衡量机器翻译系统质量的指标有多种,例如: 布鲁 流星 莱波尔 公共领域的度量结果中是否存在流行的

回答 2 投票 0

如何通过新的 V2 API 使用 Google Translate TTS?

我曾经使用以下网址调用 Google Translate TTS 下载音频文件: http://translate.google.com/translate_tts?tl=en&q=Hello+world! 然而谷歌改变了工作方式......

回答 7 投票 0

使用“google_trans_new”库在 Python 中翻译数据框列

我想翻译我的 df 的“name”列,我有以下行 data1['name']=data1['name'].apply(lambda x:translator.translate(x, dest='en').text) 但我得到了错误

回答 2 投票 0

谷歌翻译不区分大小写

我正在使用 Google Translations api v2,我发现问题不在于保持区分大小写。例如:“Evaluate Network”(英语)一词被翻译为“evaluar la Red”(西班牙语),但我期望

回答 1 投票 0

httpcore._exceptions.ReadTimeout:读取操作超时 | python googletrans 库

我正在使用Python库googletrans中的翻译器。我已经很好地使用了它两个多月了,但不知何故,今天我收到了“httpcore._exceptions.ReadTimeout:读取操作超时...

回答 1 投票 0

是否有任何 API 可以访问 Google 翻译的“您是说”功能吗?

我想完全使用谷歌翻译作为API,当然他们的官方云翻译服务基本上就是这样做的。但最近我注意到一个小区别:在浏览器中,Google TL ...

回答 2 投票 0

Google Translate API 中的转录

是否可以通过Google API获得翻译单词的转录? 与 translate.google.com 中文本区域下方的内容相同。 我只需要单个单词的翻译和转录,例如

回答 2 投票 0

无需 window.location.reload 的 React 和 Google Translate 脚本解决方法

所以,我设法使用以下脚本将 Google Translate 实现到 React 中: <p>所以,我设法使用以下脚本将 Google Translate 实现到 React 中:</p> <pre><code>&lt;script src=&#34;https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit&#34; async&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; function googleTranslateElementInit() { new google.translate.TranslateElement( { pageLanguage: &#34;en&#34;, layout: window.google.translate.TranslateElement.InlineLayout.SIMPLE, }, &#34;google_translate_element&#34; ); } &lt;/script&gt; </code></pre> <p>该脚本是免费的,不需要任何 API 密钥,因此非常好用。有 3 个问题,我已经解决了其中 2 个。</p> <ol> <li>第一个问题是它有一个可以更改语言的粘性栏。然而,粘滞栏不适合当前的用户界面,所以我需要隐藏它。通过使用 CSS 隐藏它可以轻松完成此操作。</li> <li>由于粘性栏被隐藏,我需要找到一种使用 React 更改语言的方法。我已经使用以下代码成功做到了这一点: <strong>App.js</strong></li> </ol> <pre><code>import { useEffect, useState } from &#34;react&#34;; import Cookies from &#34;universal-cookie&#34;; const App = () =&gt; { const cookies = Cookies(); const googtrans = cookies.get(&#34;googtrans&#34;); const languageCode = googtrans.split(&#39;/&#39;)[2]; const [code, setCode] = useState(languageCode); const setGoogleTrans = () =&gt; { document.cookie = &#34;googtrans=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;&#34;; cookies.set(&#34;googtrans&#34;, `/en/${code}`, { domain: `${window.location.hostname}`, path: &#34;/&#34;, }); window.location.reload(); }; useEffect(()=&gt;{ setGoogleTrans(); },[code]) return &lt;button onClick={() =&gt; setCode(code === &#39;en&#39; ? &#39;tl&#39; : &#39;en&#39;)} &gt; Change language &lt;/button&gt; } </code></pre> <ol start="3"> <li>然而,问题是我仍然需要 <pre><code>window.location.reload()</code></pre> 才能启动谷歌翻译。</li> </ol> <p>有没有办法让它一次setGoogleTrans就可以翻译,而不需要使用<pre><code>window.location.reload()</code></pre>?</p> </question> <answer tick="false" vote="0"> <p>我有点晚了,但是: 我正在做一个需要翻译的项目,所以我最终选择了谷歌翻译。但是当我运行该文件时,我意识到一个问题。</p> <p>每次 y 渲染脚本时,都会创建一个包含三个 div 的新脚本:</p> <pre><code>&lt;script src=&#34;//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit&#34;&gt;&lt;/script&gt; &lt;div id=&#39;translator-container&#39;&gt;...&lt;/div&gt; // you CAN&#39;T get rid of this &lt;div id=&#39;goog-gt-tt&#39;&gt;...&lt;/div&gt; &lt;div class=&#39;VIpgJd-ZVi9od-aZ2wEe-wOHMyf&#39;&gt;...&lt;/div&gt; </code></pre> <p>解决方案:每次创建新的 div 和脚本之前都删除这两个 div 和脚本。代码:</p> <pre><code>import { useEffect } from &#39;react&#39;; function useGoogleTranslateScript() { useEffect(() =&gt; { const googleScript = document.querySelector(&#39;[src=&#34;//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit&#34;]&#39;) const google_1 = document.getElementById(&#39;goog-gt-tt&#39;) const google_2 = document.getElementsByClassName(&#39;VIpgJd-ZVi9od-aZ2wEe-wOHMyf&#39;) if(googleScript){ googleScript.remove() } if(google_1) { google_1.remove() } if(google_2) { if(Object.entries(google_2).length &gt; 0) { for (const google2Element of google_2) { google2Element.remove() } } } const addScript = document.createElement(&#39;script&#39;); addScript.setAttribute( &#39;src&#39;, &#39;//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit&#39; ); document.body.appendChild(addScript); // debugger window.googleTranslateElementInit = () =&gt; { new window.google.translate.TranslateElement( { pageLanguage: &#39;en&#39;, autoDisplay: true, }, &#39;google_translate_element&#39; ); }; }, []); } export default useGoogleTranslateScript; </code></pre> </answer> </body></html>

回答 0 投票 0

谷歌翻译。未捕获的类型错误:减少没有初始值的空数组

当我从配置中删除 pageLanguage 并尝试将 Google 翻译添加到我的网站时,Google 翻译出现错误。我知道如何重现它,我在不同的环境中进行了测试......

回答 1 投票 0

深度翻译库中的 SSL 认证错误

deep_translator版本:1.9.1 Python版本:3.9 操作系统:Win 11 我的代码: 从 deep_translator 导入 GoogleTranslator 翻译者 = GoogleTranslator(源='en', 目标='pt') 数据 = 'm...

回答 1 投票 0

使用谷歌翻译插件自动翻译网站(IP 和接受语言)?

有没有办法使用 Google 翻译插件根据访问者的 IP 和“接受语言”标头信息自动翻译我的网站? 谢谢!

回答 2 投票 0

如何添加一个按钮,自动将页面翻译成一种语言,而无需从下拉菜单中进行选择?

如何添加一个按钮,自动将页面翻译成一种语言,而无需从下拉菜单中进行选择?我正在使用博客平台。

回答 1 投票 0

在 R 中翻译文本

在寻找在 R 中翻译文本的解决方案时,我得到了很多相当旧的答案,建议使用包 translateR。我找到的最好的答案就是这个。 答案是6岁...

回答 3 投票 0

实施谷歌翻译

我使用 Google Translate 将名称从一种语言翻译成另一种语言(使用 C#)。 我正在尝试使用 MS Access VBA 执行相同的操作。 工作 C# 代码。 公共字符串 trans_arabic_to_english(字符串单词) ...

回答 1 投票 0

Microsoft Azure 翻译器使用类似 html 页面的谷歌翻译器下拉菜单

如何使用 Microsoft Azure Translator(如 Google Translator 下拉菜单)处理 html 页面? 我有 Microsoft Azure Translator 的 API 密钥。 这是示例屏幕截图:

回答 1 投票 0

谷歌音译与翻译API

我们希望使用谷歌云服务或任何其他类似/规模化平台将句子从英语音译为印地语。 目前我们开始使用谷歌翻译,因为它的音译 API 是

回答 6 投票 0

禁止请求谷歌翻译API

我在向谷歌翻译发出请求时收到错误 403(禁止)。我有一个免费试用期,将于 2023 年 12 月结束。api 密钥处于活动状态。我使用nordvpn。我不是每天都使用。九月份它起作用了。变种

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.