配置自動建議

在 4.13 版本變更: Prior to Weblate 4.13, the services were configured in the 配置.

The support for several machine translation and translation memory services is built-in. Each service can be turned on by the administrator for whole site or at the project settings:

../_images/project-machinery.png

備註

They come subject to their terms of use, so ensure you are allowed to use them how you want.

The services translate from the source language as configured at 組件配置, see 來源語言.

也參考

自動建議

Amagama

服務編號:

amagama

配置:

This service has no configuration.

Special installation of tmserver run by the authors of Virtaal.

Apertium APy

服務編號:

apertium-apy

配置:

url

API URL

開源原件機器翻譯平台提供一組有限語言的翻譯。

使用 Apertium的推薦方式是運行您自己的 Apertium-APy 服務器。

AWS

在 3.1 版本新加入.

服務編號:

aws

配置:

key

存取金鑰 ID

secret

API 金鑰

region

區域名稱

Amazon Translate 是神經機器翻譯服務,用於將英語與廣泛支持的語言進行互譯。

Baidu

在 3.2 版本新加入.

服務編號:

baidu

配置:

key

使用者端 ID

secret

使用者端秘密金鑰 (secret)

由百度提供的機器翻譯服務。

這項服務使用 API,並且您需要從百度獲得 ID 和 API 密鑰來使用它。

DeepL

在 2.20 版本新加入.

服務編號:

deepl

配置:

url

API URL

key

API 金鑰

DeepL 是付費服務,提供一些語言的良好機器翻譯。您需要購買 DeepL API 訂閱,或者您可以使用傳統的 DeepL Pro (classic) 計劃。

API URL to use with the DeepL service. At the time of writing, there is the v1 API as well as a free and a paid version of the v2 API.

https://api.deepl.com/v2/ (在 Weblate 預設使用)

Is meant for API usage on the paid plan, and the subscription is usage-based.

https://api-free.deepl.com/v2/

Is meant for API usage on the free plan, and the subscription is usage-based.

https://api.deepl.com/v1/

Is meant for CAT tools and is usable with a per-user subscription.

此前 Weblate 被 DeepL 分類為計算機輔助翻譯工具,因此應該使用 v1 API,但現在應該使用 v2 API。這樣預設為 v2,在您有現有的計算機輔助翻譯工具訂閱,並想要 Weblate 使用它的情況下,可以將其更改為 v1。

The easiest way to find out which one to use is to open an URL like the following in your browser:

https://api.deepl.com/v2/translate?text=Hello&target_lang=FR&auth_key=XXX

Replace the XXX with your auth_key. If you receive a JSON object which contains 「Bonjour」, you have the correct URL; if not, try the other three.

Weblate supports DeepL formality, it will choose matching one based on the language (for example, there is de@formal and de@informal).

Glosbe

服務編號:

glosbe

配置:

This service has no configuration.

幾乎每一種活語言的免費字典與翻譯服務。

The API is gratis to use, but usage of the translations is subject to the license of the used data source. There is a limit of calls that may be done from one IP in a set period of time, to prevent abuse.

也參考

Glosbe website

Google翻譯

服務編號:

google-translate

配置:

key

API 金鑰

Google 提供的機器翻譯服務。

這項服務使用了 Google Translation API,您需要得到 API 密鑰,並在 Google API 控制台打開記費。

Google Translate API v3

服務編號:

google-translate-api-v3

配置:

credentials

Google 翻譯服務帳號資訊

project

Google 翻譯專案

location

Google Translate 位置

Google 雲服務提供的機器翻譯服務。

LibreTranslate

在 4.7.1 版本新加入.

服務編號:

libretranslate

配置:

url

API URL

key

API 金鑰

LibreTranslate is a free and open-source service for machine translations. The public instance requires an API key, but LibreTranslate can be self-hosted and there are several mirrors available to use the API for free.

https://libretranslate.com/ (官方公開服務)

Requires an API key to use outside of the website.

Microsoft Terminology

在 2.19 版本新加入.

服務編號:

microsoft-terminology

配置:

This service has no configuration.

Microsoft Terminology Service API 允許您通過 Web 服務,可編程地訪問 Langurage Portal 上可用的術語、定義和使用者界面( UI )字串。

微軟的 Translator

在 2.10 版本新加入.

服務編號:

microsoft-translator

配置:

key

API 金鑰

base_url

應用程式基礎 URL

Available choices:

api.cognitive.microsofttranslator.com – Global (non-regional)

api-apc.cognitive.microsofttranslator.com – Asia Pacific

api-eur.cognitive.microsofttranslator.com – Europe

api-nam.cognitive.microsofttranslator.com – North America

api.translator.azure.cn – 中國

api.cognitive.microsofttranslator.us – Azure US Government cloud

endpoint_url

Authentication service URL

Regional or multi-service can be spcified using region field below.

Available choices:

api.cognitive.microsoft.com – Global

api.cognitive.azure.cn – China

api.cognitive.microsoft.us – Azure US Government cloud

region

Authentication service region

由 Microsoft 在 Azure 門戶提供的機器翻譯服務,作為 Cognitive Services 的一種。

Weblate 實施了 Translator API V3.

Translator Text API 第二版

您用於Translator API V2 的密鑰可以用於 API 3。

Translator Text API 第三版

You need to register at Azure portal and use the key you obtain there. With new Azure keys, you also need to set region to locale of your service.

提示

對於 Azure 中國,請使用您的 Azure Portal 的端點。

ModernMT

在 4.2 版本新加入.

服務編號:

modernmt

配置:

url

API URL

key

API 金鑰

也參考

ModernMT API,

MyMemory

服務編號:

mymemory

配置:

email

聯絡信箱

username

使用者名稱

key

API 金鑰

使用機器翻譯的巨量翻譯記憶庫。

Free, anonymous usage is currently limited to 100 requests/day, or to 1000 requests/day when you provide a contact e-mail address in email. You can also ask them for more.

也參考

MyMemory 網站

Netease Sight

在 3.3 版本新加入.

服務編號:

netease-sight

配置:

key

使用者端 ID

secret

使用者端秘密金鑰 (secret)

Machine translation service provided by NetEase.

這項服務使用 API,兵器額您需要從網易得到密鑰和密碼。

SAP Translation Hub

服務編號:

sap-translation-hub

配置:

url

API URL

key

API 金鑰

username

SAP 使用者名稱

password

SAP 密碼

enable_mt

啟用機器翻譯

domain

翻譯領域

翻譯領域的 ID,例如 BC。若不指定領域,這個方法會搜尋所有可用領域中的翻譯。

SAP 提供的機器翻一下服務。

You need to have a SAP account (and the SAP Translation Hub enabled in the SAP Cloud Platform) to use this service.

You can also configure whether to also use machine translation services, in addition to the term database.

備註

To access the Sandbox API, you need to set url and key.

為了存取正式環境的 API,您需要設定 url, usernamepassword

tmserver

服務編號:

tmserver

配置:

url

API URL

您可以通過使用 Translate-toolkit綁定的一個服務器並與之對話,來運行您自己的翻譯服務器。您還可以將它與 amaGama 服務器一起使用,它是 tmserver 的增強版本。

  1. 首先您會想要將一些數據導入翻譯記憶庫:

build_tmdb -d /var/lib/tm/db -s en -t cs locale/cs/LC_MESSAGES/django.po
build_tmdb -d /var/lib/tm/db -s en -t de locale/de/LC_MESSAGES/django.po
build_tmdb -d /var/lib/tm/db -s en -t fr locale/fr/LC_MESSAGES/django.po
  1. 啟動 tmserver 來收聽您的請求:

tmserver -d /var/lib/tm/db
  1. 設定 Weblate 與它建立連線,預設的 URL 為 http://localhost:8888/tmserver/

IBM Watson Language Translator

服務編號:

ibm

配置:

url

API URL

key

API 金鑰

IBM Watson Language Translator translates text from one language to another. The service offers multiple domain-specific models.

Weblate

服務編號:

weblate

配置:

This service has no configuration.

Weblate machine translation service can provide translations for strings that are already translated inside Weblate. It looks for exact matches in the existing strings.

Weblate 翻譯記憶

在 2.20 版本新加入.

服務編號:

weblate-translation-memory

配置:

This service has no configuration.

Use 翻譯記憶 as a machine translation service. Any string that has been translated in past (or uploaded to the translation memory) can be translated in this way.

Yandex

服務編號:

yandex

配置:

key

API 金鑰

Yandex 提供的機器翻譯服務。

這項服務使用翻譯 API,您需要從 Yandex 得到 API 密鑰。

Youdao Zhiyun

在 3.2 版本新加入.

服務編號:

youdao-zhiyun

配置:

key

使用者端 ID

secret

使用者端秘密金鑰 (secret)

有道提供的機器翻譯服務。

這項服務使用 API,您需要從有道獲得 ID 和 API 密鑰。

Custom machine translation

您還可以通過使用一些 Python 代碼來實施您自己的機器翻譯服務。這個例子使用 dictionary Python 模塊來實施一組固定語言的機器翻譯:

# Copyright © Michal Čihař <michal@weblate.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later

"""Machine translation example."""

import dictionary

from weblate.machinery.base import MachineTranslation


class SampleTranslation(MachineTranslation):
    """Sample machine translation interface."""

    name = "Sample"

    def download_languages(self):
        """Return list of languages your machine translation supports."""
        return {"cs"}

    def download_translations(
        self,
        source,
        language,
        text: str,
        unit,
        user,
        search: bool,
        threshold: int = 75,
    ):
        """Return tuple with translations."""
        for t in dictionary.translate(text):
            yield {"text": t, "quality": 100, "service": self.name, "source": text}

You can list your own class in WEBLATE_MACHINERY and Weblate will start using that.