- 如何让 Cloud Translation 高级版了解哪些内容不需要翻译?
您可以使用以下 HTML 标记:
<span translate="no"> </span>
<span class="notranslate"> </span>
若要使用此功能,必须采用 HTML 格式提交源文本。
- 为什么译文中会添加
style
特性 (Attribute) 以及text-align
和direction
CSS 属性 (Property)? 如果请求翻译的文本包含 HTML 格式,并且您是在以下两种语言之间进行翻译,那么就会发生这种情况:即将从右向左的语言翻译成从左向后的语言,或将从左向右的语言翻译成从右向左的语言。在翻译中加入 HTML
style
特性以及text-align
和direction
CSS 属性是为了确保按照正确的方向翻译文本。例如,将<h2>Sample text</h2>
从英语翻译为希伯来语时,系统将返回以下 JSON 代码:{ "data": { "translations": [ { "translatedText": "\u003ch2 style=\";text-align:right;direction:rtl\"\u003e טקסט לדוגמה (דברים) \u003c/h2\u003e" } ] } }
- 我在调用此 API 时遇到
HTTP 403
错误。 - 您可能超出了配额:每日计费总量或每 100 秒的字符数限制。如果您超过每日限制,则系统会显示
Daily Limit Exceeded
错误消息,或者如果您超过任一“每 100 秒的字符数”配额,则系统会显示User Rate Limit Exceeded
错误消息。如需查看或更改项目的用量限制,或申请增加配额,请按以下步骤操作:
- 如果您的项目还没有结算帐号,请创建一个。
- 在 Google Cloud 控制台中访问 API 库中的“已启用的 API”页面,然后从列表中选择一个 API。
- 如需查看和更改配额相关设置,请选择配额。如需查看用量统计信息,请选择使用量。
- 此 API 有时返回
HTTP 500 (Internal Errors)
响应 - 如果您在提交文本时没有指定源语言,则可能会发生这种情况。如果 Google 无法确定给定文本的源语言(通常是因为文本太短),我们将返回 500。要解决这种情况,明确指定源语言即可。
- 我可以在一个请求中指定多个目标语言吗?
- 您可以在批量请求中提供最多十种目标语言。如果您没有发出批量请求,则只能使用您的请求指定单一目标语言。
- 能否为一个单词提供多种翻译?
- 不能。您只能通过网页界面 (translate.google.com) 使用此功能。
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-07-02 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"很难理解"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"信息或示例代码不正确"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"没有我需要的信息/示例"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻译问题"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"易于理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"解决了我的问题"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]