Machine translation¶
Weblate has built in support for several machine translation services and it’s
up to the administrator to enable them. The services have different terms of use, so
please check whether you are allowed to use them before enabling them in Weblate.
The individual services are enabled using MT_SERVICES
.
The source language can be configured at Project configuration.
Amagama¶
Special installation of tmserver run by Virtaal authors.
To enable this service, add weblate.machinery.tmserver.AmagamaTranslation
to
MT_SERVICES
.
См.также
Apertium¶
A free/open-source machine translation platform providing translation to a limited set of languages.
The recommended way to use Apertium is to run your own Apertium APy server.
To enable this service, add weblate.machinery.apertium.ApertiumAPYTranslation
to
MT_SERVICES
and set MT_APERTIUM_APY
.
AWS¶
Добавлено в версии 3.1.
Amazon Translate is a neural machine translation service for translating text to and from English across a breadth of supported languages.
To enable this service, add weblate.machinery.aws.AWSTranslation
to
MT_SERVICES
, install the boto3 module and set the settings.
Baidu API machine translation¶
Добавлено в версии 3.2.
Machine translation service provided by Baidu.
This service uses an API and you need to obtain ID and API key from Baidu.
To enable this service, add weblate.machinery.baidu.BaiduTranslation
to
MT_SERVICES
and set MT_BAIDU_ID
and
MT_BAIDU_SECRET
.
См.также
DeepL¶
Добавлено в версии 2.20.
DeepL is paid service providing good machine translation for few languages. According to some benchmark it’s currently best available service.
To enable this service, add weblate.machinery.deepl.DeepLTranslation
to
MT_SERVICES
and set MT_DEEPL_KEY
.
См.также
Glosbe¶
Free dictionary and translation memory for almost every living language.
API is free to use, but subject to the used data source license. There is a limit of calls that may be done from one IP in fixed period of time, to prevent abuse.
To enable this service, add weblate.machinery.glosbe.GlosbeTranslation
to
MT_SERVICES
.
См.также
Google Translate¶
Machine translation service provided by Google.
This service uses Translation API and you need to obtain an API key and enable billing on Google API console.
To enable this service, add weblate.machinery.google.GoogleTranslation
to
MT_SERVICES
and set MT_GOOGLE_KEY
.
См.также
Microsoft Cognitive Services Translator¶
Добавлено в версии 2.10.
Machine translation service provided by Microsoft in Azure portal as a one of Cognitive Services.
You need to register at Azure portal and use the key you obtain there.
To enable this service, add weblate.machinery.microsoft.MicrosoftCognitiveTranslation
to
MT_SERVICES
and set MT_MICROSOFT_COGNITIVE_KEY
.
Microsoft Terminology Service¶
Добавлено в версии 2.19.
The Microsoft Terminology Service API allows you to programmatically access the terminology, definitions and user interface (UI) strings available on the Language Portal through a web service.
To enable this service, add weblate.machinery.microsoftterminology.MicrosoftTerminologyService
to
MT_SERVICES
.
См.также
MyMemory¶
Huge translation memory with machine translation.
Free, anonymous usage is currently limited to 100 requests/day, or to 1000
requests/day when you provide contact email in MT_MYMEMORY_EMAIL
.
You can also ask them for more.
To enable this service, add weblate.machinery.mymemory.MyMemoryTranslation
to
MT_SERVICES
and set MT_MYMEMORY_EMAIL
.
Netease Sight API machine translation¶
Добавлено в версии 3.3.
Machine translation service provided by Netease.
This service uses an API and you need to obtain key and secret from Netease.
To enable this service, add weblate.machinery.youdao.NeteaseSightTranslation
to
MT_SERVICES
and set MT_NETEASE_KEY
and
MT_NETEASE_SECRET
.
tmserver¶
You can run your own translation memory server which is bundled with Translate-toolkit and let Weblate talk to it. You can also use it with amaGama server, which is an enhanced version of tmserver.
First you will want to import some data to the translation memory:
To enable this service, add weblate.machinery.tmserver.TMServerTranslation
to
MT_SERVICES
.
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
Now you can start tmserver to listen to your requests:
tmserver -d /var/lib/tm/db
And configure Weblate to talk to it:
MT_TMSERVER = 'http://localhost:8888/tmserver/'
См.также
Yandex Translate¶
Machine translation service provided by Yandex.
This service uses Translation API and you need to obtain API key from Yandex.
To enable this service, add weblate.machinery.yandex.YandexTranslation
to
MT_SERVICES
and set MT_YANDEX_KEY
.
Youdao Zhiyun API machine translation¶
Добавлено в версии 3.2.
Machine translation service provided by Youdao.
This service uses an API and you need to obtain ID and API key from Youdao.
To enable this service, add weblate.machinery.youdao.YoudaoTranslation
to
MT_SERVICES
and set MT_YOUDAO_ID
and
MT_YOUDAO_SECRET
.
Weblate¶
Weblate can be source of machine translation as well. It is based on the fulltext engine Whoosh and provides both exact and inexact matches.
To enable these services, add
weblate.machinery.weblatetm.WeblateTranslation
to
MT_SERVICES
.
Weblate Translation Memory¶
Добавлено в версии 2.20.
The Translation Memory can be used as source for machine translation suggestions as well.
To enable these services, add weblate.memory.machine.WeblateMemory
to
the MT_SERVICES
. This service is enabled by
default.
SAP Translation Hub¶
Machine translation service provided by SAP.
You need to have a SAP account (and enabled the SAP Translation Hub in the SAP Cloud Platform) to use this service.
To enable this service, add
weblate.machinery.saptranslationhub.SAPTranslationHub
to
MT_SERVICES
and set appropriate access to either
sandbox or productive API.
Примечание
To access the Sandbox API, you need to set MT_SAP_BASE_URL
and MT_SAP_SANDBOX_APIKEY
.
To access the productive API, you need to set MT_SAP_BASE_URL
,
MT_SAP_USERNAME
and MT_SAP_PASSWORD
.
Custom machine translation¶
You can also implement your own machine translation services using a few lines of
Python code. This example implements translation to a fixed list of
languages using dictionary
Python module:
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2019 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
"""Machine translation example."""
from weblate.machinery.base import MachineTranslation
import dictionary
class SampleTranslation(MachineTranslation):
"""Sample machine translation interface."""
name = 'Sample'
def download_languages(self):
"""Return list of languages your machine translation supports."""
return set(('cs',))
def download_translations(self, source, language, text, unit, user):
"""Return tuple with translations."""
return [(t, 100, self.name, text) for t in dictionary.translate(text)]
You can list own class in MT_SERVICES
and Weblate
will start using that.