Commit 97b44647 authored by Michal Čihař's avatar Michal Čihař

Add support for Amagama service

parent a63fed07
...@@ -425,6 +425,16 @@ up to adminitrator to enable them. The services have different terms of use, so ...@@ -425,6 +425,16 @@ up to adminitrator to enable them. The services have different terms of use, so
please check whether you are allowed to use them before enabling in Weblate. please check whether you are allowed to use them before enabling in Weblate.
The individual services are enabled using :setting:`MACHINE_TRANSLATION_SERVICES`. The individual services are enabled using :setting:`MACHINE_TRANSLATION_SERVICES`.
Amagama
+++++++
Special installation of :ref:`tmserver` run by Virtaal authors.
To enable this service, add ``trans.machine.tmserver.AmagamaTranslation`` to
:setting:`MACHINE_TRANSLATION_SERVICES`.
.. seealso:: http://docs.translatehouse.org/projects/virtaal/en/latest/amagama.html
Apertium Apertium
++++++++ ++++++++
......
...@@ -73,3 +73,11 @@ class TMServerTranslation(MachineTranslation): ...@@ -73,3 +73,11 @@ class TMServerTranslation(MachineTranslation):
return [(line['target'], line['quality'], self.name, line['source']) return [(line['target'], line['quality'], self.name, line['source'])
for line in response] for line in response]
class AmagamaTranslation(TMServerTranslation):
'''
Specific instance of tmserver ran by Virtaal authors.
'''
def get_server_url(self):
return 'http://amagama.locamotion.org'
...@@ -27,6 +27,7 @@ from trans.machine.glosbe import GlosbeTranslation ...@@ -27,6 +27,7 @@ from trans.machine.glosbe import GlosbeTranslation
from trans.machine.mymemory import MyMemoryTranslation from trans.machine.mymemory import MyMemoryTranslation
from trans.machine.opentran import OpenTranTranslation from trans.machine.opentran import OpenTranTranslation
from trans.machine.apertium import ApertiumTranslation from trans.machine.apertium import ApertiumTranslation
from trans.machine.tmserver import AmagamaTranslation
from trans.machine.microsoft import ( from trans.machine.microsoft import (
MicrosoftTranslation, microsoft_translation_supported MicrosoftTranslation, microsoft_translation_supported
) )
...@@ -82,6 +83,10 @@ class MachineTranslationTest(TestCase): ...@@ -82,6 +83,10 @@ class MachineTranslationTest(TestCase):
machine = GoogleTranslation() machine = GoogleTranslation()
self.assertIsInstance(machine.translate('cs', 'world', None), list) self.assertIsInstance(machine.translate('cs', 'world', None), list)
def test_amagama(self):
machine = AmagamaTranslation()
self.assertIsInstance(machine.translate('cs', 'world', None), list)
class WeblateTranslationTest(ViewTestCase): class WeblateTranslationTest(ViewTestCase):
def test_same(self): def test_same(self):
......
...@@ -380,6 +380,7 @@ WHOOSH_INDEX = os.path.join(WEB_ROOT, 'whoosh-index') ...@@ -380,6 +380,7 @@ WHOOSH_INDEX = os.path.join(WEB_ROOT, 'whoosh-index')
# 'trans.machine.microsoft.MicrosoftTranslation', # 'trans.machine.microsoft.MicrosoftTranslation',
# 'trans.machine.mymemory.MyMemoryTranslation', # 'trans.machine.mymemory.MyMemoryTranslation',
# 'trans.machine.opentran.OpenTranTranslation', # 'trans.machine.opentran.OpenTranTranslation',
# 'trans.machine.tmserver.AmagamaTranslation',
# 'trans.machine.tmserver.TMServerTranslation', # 'trans.machine.tmserver.TMServerTranslation',
# 'trans.machine.weblatetm.WeblateSimilarTranslation', # 'trans.machine.weblatetm.WeblateSimilarTranslation',
# 'trans.machine.weblatetm.WeblateTranslation', # 'trans.machine.weblatetm.WeblateTranslation',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment