If so you can download any of the below versions for testing. The product will function as normal except for an evaluation limitation. At the time of purchase we provide a license file via email that will allow the product to work in its full capacity. If you would also like an evaluation license to test without any restrictions for 30 days, please follow the directions provided here.
If you experience errors, when you try to download a file, make sure your network policies (enforced by your company or ISP) allow downloading ZIP and/or MSI files.

安装
该软件包在 pypi.org 上 可用,可以通过执行以下命令通过 pip 安装:
pip install groupdocs-translation-cloud

用于翻译云的 Python SDK Documents
GroupDocs.Translation Cloud 是云 API,用于翻译 Word(包括 RTF 和 TXT 文件)、Excel(包括 CSV / TSV 文件)、PowerPoint、PDF、HTML、Markdown(包括 Hugo 语法的 Markdown)、OpenDocument、RESX、SRT 文件、JPG、PNG、SVG、BMP 和 GIF 格式的图像以及扫描的 PDF 以及纯文本。
为了方便我们的 Python 客户,我们推出了一个简单的 SDK,只需几行代码即可帮助将上述所有文档和图像文件格式以及纯文本的翻译添加到您的应用程序中。
详细来说,它是一组用于在我们的云中进行文档和纯文本翻译的 SDK。它支持翻译.doc、.docx、.docm、.xls、.xlsx、.xlsm、.ppt、.pptx、.pptm、.pdf、.html、.md、.odt、.ods、.odp、.csv、.tsv、.rtf、.txt、.resx、.srt、.png、.jpg、 .svg、.bmp 和 .gif 文件。只需将特定文件或文本传递给GroupDocs.Translation Cloud API,它就会翻译并将翻译后的文件保存在 S3 中或返回翻译后的文本。
GroupDocs.Translation Cloud上手非常简单,无需安装任何东西。在 GroupDocs Cloud 上创建一个帐户并获取您的应用程序信息,然后您就可以使用 SDK 了。
云文档翻译功能
- Microsoft Word®、Microsoft Excel® 和 Microsoft PowerPoint® 文档的翻译
- 46种语言和140种语言对支持
- 翻译 Word 文档和 ODT 文件中的表格、页眉、页脚、脚注/尾注、图像标题
- Excel 文档和 ODS 文件中的单元格、图表、表格、数据透视表的翻译
- 翻译 PowerPoint 演示文稿和 ODP 文件中的文本框架、表格、页眉、页脚、图表、注释
- PDF文件的翻译
- Markdown 文件的翻译
- Markdown 文件中 Hugo 语法的翻译
- 纯文本翻译
- RESX 格式的 .NET 资源的翻译
- SRT格式字幕翻译
- 翻译图像和扫描的 PDF,得到纯文本或 PDF
- 翻译扫描的表格,得到 Excel 工作簿作为结果
- 手写文本翻译
支持的翻译格式
您应该指定要翻译的文档格式,并在请求正文中放入适当的枚举值。
此外,用户可以获得任何其他可用于转换的格式的翻译文件。只需通过将文件扩展名放入请求正文中来指定翻译文档的输出格式:
- doc、docx、odt、rtf — docx、rtf、html、odt、txt、md、pdf、tiff、svg、xps
- xls、xlsx、ods、csv、tsv — xlsx、xlsb、html、pdf、xps、ods、md、docx、pptx、tiff
- ppt、pptx、odp — pptx、pdf、tiff、html、xps、odp
- pdf — docx、pptx、html、svg、xps
- md — html、pdf、docx、tiff、xps
- html — md、pdf、docx、tiff、xps
详情请参阅支持的格式。
支持的翻译语言
- en-fr / fr-en — to translate from English to French or from French to English.
- en-de / de-en — to translate from English to German or from German to English.
- en-es / es-en — to translate from English to Spanish or from Spanish to English.
- en-it / it-en — to translate from English to Italian or from Italian to English.
- en-zh / zh-en — to translate from English to Chinese or from Chinese to English.
- en-ru / ru-en — to translate from English to Russian or from Russian to English
- en-ar / ar-en — to translate from English to Arabic or from Arabic to English
- en-pt / pt-en — to translate from English to Portuguese or from Portuguese to English
- en-pl / pl-en — to translate from English to Polish or from Polish to English
- en-uk / uk-en — to translate from English to Ukrainian or from Ukrainian to English
- en-vi / vi-en — to translate from English to Vietnamese or from Vietnamese to English
- en-id / id-en — to translate from English to Indonesian or from Indonesian to English
- en-hi / hi-en — to translate from English to Hindi or from Hindi to English
- en-el / el-en — to translate from English to Greek or from Greek to English
- en-nl / nl-en— to translate from English to Dutch or from Dutch to English
- en-hu / hu-en — to translate from English to Hunngarian or from Hungarian to English
- en-sv / sv-en — to translate from English to Swedish or from Swedish to English
- en-tr / tr-en — to translate from English to Turkish or from Turkish to English
- en-ja / ja-en — to translate from English to Japanese or from Japanese to English
- en-ko / ko-en — to translate from English to Korean or from Korean to English
- en-cs / cs-en — to translate from English to Czech or from Czech to English
- en-fi / fi-en — to translate from English to Finnish or from Finnish to English
- en-ga / ga-en — to translate from English to Irish or from Irish to English
- en-fa / fa-en — to translate from English to Farsi or from Farsi to English
- en-az / az-en — to translate from English to Azerbaijani or from Azerbaijani to English
- en-he / he-en — to translate from English to Hebrew or from Hebrew to English
- en-sk / sk-en — to translate from English to Slovak or from Slovak to English
- en-th / th-en — to translate from English to Thai or from Thai to English
- en-ro / ro-en — to translate from English to Romanian or from Romanian to English
- en-ms / ms-en — to translate from English to Malay or from Malay to English
- en-bg / bg-en — to translate from English to Bulgarian or from Bulgarian to English
- en-bn / bn-en — to translate from English to Bengali or from Bengali to English
- en-da / da-en — to translate from English to Danish or from Danish to English
- en-lt / lt-en — to translate from English to Lithuanian or from Lithuanian to English
- en-lv / lv-en — to translate from English to Latvian or from Latvian to English
- en-no / no-en — to translate from English to Norwegian or from Norwegian to English
- en-et / et-en — to translate from English to Estonian or from Estonian to English
- en-hy / hy-en — to translate from English to Armenian or from Armenian to English
- en-ca / ca-en — to translate from English to Catalan or from Catalan to English
- en-hr / hr-en — to translate from English to Croatian or from Croatian to English
- en-sr / sr-en — to translate from English to Serbian or from Serbian to English
- en-af / af-en — to translate from English to Afrikaans or from Afrikaans to English
- en-ur / ur-en — to translate from English to Urdu or from Urdu to English
- en-tl / tl-en — to translate from English to Tagalog or from Tagalog to English
- en-ka / ka-en — to translate from English to Georgian or from Georgian to English
- fr-de / de-fr — to translate from French to German or from German to French
- fr-it / it-fr — to translate from French to Italian or from Italian to French
- fr-ar / ar-fr — to translate from French to Arabic or from Arabic to French
- fr-es / es-fr — to translate from French to Spanish or from Spanish to French
- fr-id / id-fr — to translate from French to Indonesian or from Indonesian to French
- fr-ms / ms-fr — to translate from French to Malay or from Malay to French
- fr-pl / pl-fr — to translate from French to Polish or from Polish to French
- fr-ru / ru-fr — to translate from French to Russian or from Russian to French
- fr-ar / ar-fr — to translate from French to Arabic or from Arabic to French
- de-it / it-de — to translate from German to Italian or from Italian to German
- de-pl / pl-de — to translate from German to Polish or from Polish to German
- de-ar / ar-de — to translate from German to Arabic or from Arabic to German
- de-zh / zh-de — to translate from German to Chinese or from Chinese to German
- de-es / es-de — to translate from German to Spanish or from Spanish to German
- de-ms / ms-de — to translate from German to Malay or from Malay to German
- de-uk / uk-de — to translate from German to Ukrainian or from Ukrainian to German
- it-es / es-it — to translate from Italian to Spanish or from Spanish to Italian
- it-ar / ar-it — to translate from Italian to Arabic or from Arabic to Italian
- it-uk / uk-it — to translate from Italian to Ukrainian or from Ukrainian to Italian
- it-ms / ms-it — to translate from Italian to Malay or from Malay to Italian
- sv-zh / zh-sv — to translate from Swedish to Chinese or from Chinese to Swedish
- ar-es / es-ar — to translate from Arabic to Spanish or from Spaish to Arabic
- ar-tr / tr-ar — to translate from Arabic to Turkish or from Turkish to Arabic
- ar-pl / pl-ar — to translate from Arabic to Polish or from Polish to Arabic
- ru-es / es-ru — to translate from Russian to Spanish or from Spaish to Russian
JSON 请求详细信息
您可以将以下信息放入请求正文中来翻译文档:
- 格式 — 翻译文件的格式
- outputFormat — 翻译文件的格式(例如 pdf)
- sourceLanguage — 原始文档的语言(例如 en)
- targetLanguages — 翻译语言列表(例如 [fr, de])
- file — 以字节数组形式翻译的文件
- url — 要翻译的文件的链接,应提供文件或 url
- originalFileName — 要翻译的文件的原始名称,如果为 null 或空请求 ID,则将使用
- masters — 是否应翻译母版幻灯片(仅用于演示,传递 true 或 false)
- elements — 要翻译的幻灯片页面(仅适用于演示文稿,传递空列表来翻译整个演示文稿)
- 分隔符 — CSV 文件的分隔符
- 范围 - Excel 工作簿中的范围字典
- shortcodedict — Hugo 中要翻译的短代码语法字典,其中键是从零开始的短代码索引,值是需要翻译的参数名称列表
- frontmatterdict — Hugo 中要翻译的前文语法字典,其中键是从零开始的前文索引,值是需要翻译的值的路径列表,每个路径也是一个列表。
要翻译纯文本,应将以下信息放入请求正文中:
- sourceLanguage — 原始文本的语言(例如 en)
- targetLanguages — 翻译语言列表(例如 [fr, de])
- 文本 — 要翻译的文本列表(例如 [hello world])
- contains-markdown — 如果文本包含 markdown 语法则为 true
如何使用SDK?
我们的 API 完全独立于您的操作系统、数据库系统或开发语言。您可以使用任何支持 HTTP 的语言和平台与我们的 API 进行交互。然而,手动编写客户端代码可能很困难、容易出错且耗时。因此,我们提供并支持多种开发语言的SDK,以便您的云应用程序更容易与我们集成。
快速入门
1. 如果没有,请获取 API 密钥
在 GroupDocs Cloud Dashboard 创建个人账户,然后点击 获取密钥。这些密钥对于所有 GroupDocs Cloud 产品都很有用。如果您有任何问题,请查看这个详细手册。收到密钥后,请按照文章尝试GroupDocs.Translation Cloud或熟悉开发者指南以了解更多详情。
2.安装SDK
通过以下方式从 PyPI 安装 groupdocs-translation-cloud 和 PIP:
pip install groupdocs-translation-cloud
或者克隆存储库并通过Setuptools安装它:
3. 运行演示
- 查看 SDK 或从 PiPy 获取
- 设置您的 client_id 和 client_secret
- 运行 Jupyter Notebook demo.ipynb
### 结构
该项目包括:
- 模块“groupdocstranslationcloud”,这是SDK。您可以将其集成到您的应用程序中。它包含翻译和存储 API
- 模块“测试”,单元测试。您可以查看它们以查看各种代码示例。
- Jupyter 笔记本“演示”。示例演示笔记本。
依赖关系
版本支持
Python :: 2.7、Python :: 3、Python :: 3.4、Python :: 3.5、Python :: 3.6、Python :: 3.7、Python :: 3.8
翻译纯文本
# Load the gem
import groupdocs_translation_cloud
# Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
my_client_id = ""
my_client_secret = ""
# Create instance of the API
configuration = Configuration(apiKey=my_client_secret, appSid=my_client_id)
api = TranslationApi(configuration)
#document translation
pair = "en-fr"
_format = "docx"
storage = "First Storage"
name = "test.docx"
folder = ""
savepath = ""
savefile = "test_python.docx"
masters = False
elements = []
translator = TranslateDocument(pair, _format, storage, name, folder, savepath, savefile, masters, elements)
request = translator.to_string()
res_doc = api.post_translate_document(request)
print(res_doc.message)
API 端点的文档
所有 URI 都相对于 https://api.groupdocs.cloud/v2.0/translation
| 班级 | | 方法 | HTTP 请求 | 描述 |
|---|
TranslationApi | | autoPost | 发布 /auto | 翻译任何支持的文件 |
TranslationApi | | csvPost | 发布 /csv | 翻译 CSV 和 TSV 文件 |
TranslationApi | | documentPost | 发布 /document | 翻译 Microsoft Word 文档、rtf、txt、odt |
TranslationApi | | documentRequestIdGet | 获取 /document/{requestId} | 返回文档翻译状态。 如果翻译成功,还返回用于下载翻译文档的 URL |
TranslationApi | | documentTrialPost | 发布 /document/trial | 尝试在无对话的情况下翻译 Microsoft Word 文档、rtf、txt、odt。仅翻译第一页或 1000 个符号。 |
TranslationApi | | hcGet | 获取 /hc | 所有服务的健康检查。 |
TranslationApi | | htmlPost | 发布 /html | 翻译 HTML 文件 |
TranslationApi | | hugoGet | 获取 /hugo | 从markdown文件中获取hugo语法结构 |
TranslationApi | | hugoPost | 发布 /hugo | 从 Markdown 文件运行 Hugo 语法结构分析 |
TranslationApi | | imageToFilePost | 发布 /image-to-file | 翻译图像或扫描的 pdf 并返回文件 |
TranslationApi | | imageToTextPost | 发布 /image-to-text | 翻译图像或扫描的 pdf 上的文本 |
TranslationApi | | languagesGet | 获取 /languages | 返回可用语言对的列表 |
TranslationApi | | markdownPost | 发布 /markdown | 翻译 Markdown 文件 |
TranslationApi | | pdfPost | 发布 /pdf | 翻译 pdf 文件 |
TranslationApi | | pdfTrialPost | 发布 /pdf/trial | 试用pdf翻译。仅翻译第一页,而不转换为其他格式。 |
TranslationApi | | presentationPost | 发布 /presentation | 翻译 Microsoft PowerPoint 演示文稿、odp |
TranslationApi | | resxPost | 发布 /resx | 翻译 RESX 文件 |
TranslationApi | | spreadsheetPost | 发布 /spreadsheet | 翻译 Microsoft Excel 工作簿、ods |
TranslationApi | | textPost | 发布 /text | 翻译文本 |
TranslationApi | | textRequestIdGet | 获取 /text/{requestId} | 返回文本翻译状态。 如果翻译成功,还返回翻译后的文本 |
TranslationApi | | textTrialPost | 发布 /text/trial | 尝试翻译文本。仅翻译 1000 个符号。 |
模型文档
CloudFileResponse, CloudHugoResponse, CloudTextResponse, CsvFileRequest, FileRequest, HealthCheckStatus, HtmlFileRequest, HttpStatusCode, HugoRequest, ImageToFileRequest, ImageToTextRequest, LanguagePairData, MarkdownFileRequest, PdfFileRequest, PresentationFileRequest, ResxFileRequest, SpreadsheetFileRequest, StatusResponse, StringStringTuple, TextDocumentFileRequest, TextRequest, UrlFileInfo, WorksheetData
GroupDocs.Translation Cloud SKD
GitHub

包管理器

