Commit 6e494351 authored by Michal Čihař's avatar Michal Čihař

Define URL at single place

parent 14c60428
...@@ -22,6 +22,10 @@ from trans.machine.base import MachineTranslation, MachineTranslationError ...@@ -22,6 +22,10 @@ from trans.machine.base import MachineTranslation, MachineTranslationError
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from weblate import appsettings from weblate import appsettings
BASE_URL = 'http://api.microsofttranslator.com/V2/Ajax.svc/'
TRANSLATE_URL = BASE_URL + 'Translate'
LIST_URL = BASE_URL + 'GetLanguagesForTranslate'
def microsoft_translation_supported(): def microsoft_translation_supported():
''' '''
...@@ -100,9 +104,7 @@ class MicrosoftTranslation(MachineTranslation): ...@@ -100,9 +104,7 @@ class MicrosoftTranslation(MachineTranslation):
''' '''
Downloads list of supported languages from a service. Downloads list of supported languages from a service.
''' '''
data = self.json_req( data = self.json_req(LIST_URL)
'http://api.microsofttranslator.com/V2/Ajax.svc/GetLanguagesForTranslate'
)
return data return data
def format_match(self, match): def format_match(self, match):
...@@ -130,10 +132,5 @@ class MicrosoftTranslation(MachineTranslation): ...@@ -130,10 +132,5 @@ class MicrosoftTranslation(MachineTranslation):
'contentType': 'text/plain', 'contentType': 'text/plain',
'category': 'general', 'category': 'general',
} }
response = self.json_req( response = self.json_req(TRANSLATE_URL, **args)
'http://api.microsofttranslator.com/V2/Ajax.svc/Translate',
**args
)
return [(response, 100)] return [(response, 100)]
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