mirror of
https://gh.wpcy.net/https://github.com/WeblateOrg/weblate.git
synced 2026-04-26 10:52:09 +08:00
83 lines
3 KiB
ReStructuredText
83 lines
3 KiB
ReStructuredText
.. _machine-translation-setup:
|
|
|
|
Automatic suggestions
|
|
=====================
|
|
|
|
.. versionchanged:: 4.13
|
|
|
|
Prior to Weblate 4.13, the services were configured in the :ref:`config`.
|
|
|
|
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
|
|
(under :guilabel:`Automatic suggestions` in :ref:`management-interface`) or at
|
|
the project settings:
|
|
|
|
.. image:: /screenshots/project-machinery.webp
|
|
|
|
.. note::
|
|
|
|
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
|
|
:ref:`component`, see :ref:`component-source_language`.
|
|
|
|
Per-project automatic suggestion can also be configured via the :ref:`api`.
|
|
|
|
.. seealso::
|
|
|
|
:ref:`machine-translation`
|
|
|
|
.. _mt-translation-services-priority:
|
|
|
|
Priority of machine translation and translation memory services
|
|
----------------------------------------------------------------
|
|
|
|
:ref:`mt-weblate-translation-memory` matches with 100% score take priority over machine translation services. If 100% match in translation memory is found, no machine translation is performed. If several 100% matches occur, the first one returned by the database is used.
|
|
|
|
Each machine translation service has a predefined maximum score it can produce. The use of installed translation services is ordered according to their maximum score. For each string with translation score lower than the service's maximum, the service is asked to produce a translation. Translations with a score exceeding the current one are accepted.
|
|
|
|
.. _mt-sources:
|
|
|
|
Source strings for the machine translation
|
|
------------------------------------------
|
|
|
|
.. versionadded:: 5.11
|
|
|
|
The origin of source strings for all third-party services can be configured.
|
|
This can be used to tweak the service to get the best results. Following choices are available:
|
|
|
|
:guilabel:`Automatic selection`
|
|
Chooses the best source language automatically.
|
|
|
|
This is the default behavior.
|
|
:guilabel:`Component source language`
|
|
Uses the component source language.
|
|
|
|
This was the behavior before the 5.11 release.
|
|
:guilabel:`Secondary language defined in project or component`
|
|
Use project :ref:`project-secondary_language` or component :ref:`component-secondary_language`.
|
|
|
|
Falls back to the automatic selection of the source language if the secondary language not configured.
|
|
|
|
|
|
.. include:: /snippets/machines-autogenerated.rst
|
|
|
|
.. _custom-machinery:
|
|
|
|
Custom machine translation
|
|
--------------------------
|
|
|
|
You can also implement your own machine translation services using a few lines
|
|
of Python code. Place the code in a module Weblate can import (see
|
|
:ref:`custom-module` or :ref:`docker-python-override`) and add fully qualified
|
|
class name to :setting:`WEBLATE_MACHINERY`.
|
|
|
|
.. literalinclude:: ../../weblate/examples/mt_service.py
|
|
:language: python
|
|
|
|
.. seealso::
|
|
|
|
* :ref:`custom-modules`
|
|
* :ref:`custom-module`
|
|
* :ref:`docker-python-override`
|