Commit ec8e2c36 authored by Michal Čihař's avatar Michal Čihař

Allow to configure mail for mymemory service

parent d3ed1769
......@@ -492,14 +492,15 @@ MyMemory
Huge translation memory with machine translation.
Free, anonymous usage is currently limited to 100 requests/day, you can ask for
more.
Free, anonymous usage is currently limited to 100 requests/day, or to 1000 with
:setting:`MT_MYMEMORY_EMAIL`, you can ask for more.
To enable this service, add ``trans.machine.mymemory.MyMemoryTranslation`` to
:setting:`MACHINE_TRANSLATION_SERVICES`.
.. seealso::
:setting:`MT_MYMEMORY_EMAIL`,
http://mymemory.translated.net/
Open-Tran
......
......@@ -208,6 +208,15 @@ Client secret for Microsoft Translator service.
.. seealso:: :ref:`machine-translation-setup`, :ref:`machine-translation`, https://datamarket.azure.com/developer/applications/
.. setting:: MT_MYMEMORY_EMAIL
MT_MYMEMORY_EMAIL
-----------------
MyMemory identification email, you can get 1000 requests per day with this.
.. seealso:: :ref:`machine-translation-setup`, :ref:`machine-translation`, http://mymemory.translated.net/doc/spec.php
.. setting:: MT_TMSERVER
MT_TMSERVER
......
......@@ -19,6 +19,7 @@
#
from trans.machine.base import MachineTranslation
from weblate import appsettings
class MyMemoryTranslation(MachineTranslation):
......@@ -67,10 +68,16 @@ class MyMemoryTranslation(MachineTranslation):
'''
Downloads list of possible translations from a service.
'''
args = {
'q': text,
'langpair': 'en|%s' % language,
}
if appsettings.MT_MYMEMORY_EMAIL is not None:
args['de'] = appsettings.MT_MYMEMORY_EMAIL
response = self.json_status_req(
'http://mymemory.translated.net/api/get',
q=text,
langpair='en|%s' % language,
**args
)
return [self.format_match(match) for match in response['matches']]
......@@ -43,6 +43,10 @@ MT_APERTIUM_KEY = get('MT_APERTIUM_KEY', None)
MT_MICROSOFT_ID = get('MT_MICROSOFT_ID', None)
MT_MICROSOFT_SECRET = get('MT_MICROSOFT_SECRET', None)
# MyMemory identification email, see
# http://mymemory.translated.net/doc/spec.php
MT_MYMEMORY_EMAIL = get('MT_MYMEMORY_EMAIL', None)
# tmserver URL
MT_TMSERVER = get('MT_TMSERVER', None)
......
......@@ -278,6 +278,10 @@ MT_APERTIUM_KEY = None
MT_MICROSOFT_ID = None
MT_MICROSOFT_SECRET = None
# MyMemory identification email, see
# http://mymemory.translated.net/doc/spec.php
MT_MYMEMORY_EMAIL = None
# tmserver URL
MT_TMSERVER = None
......
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