1. Monwara LLC
  2. Untitled project
  3. PyMSTranslator

Source

PyMSTranslator / mstranslator / endpoints / translate.py

Diff from to

File mstranslator/endpoints/translate.py

  • Ignore whitespace
 class TranslateEndpoint(GetEndpoint):
     endpoint = 'Translate'
 
-    def __init__(self, text, tfrom, to):
+    def __init__(self, text, to, tfrom=None):
 
-        if tfrom not in LANGUAGE_CODES or to not in LANGUAGE_CODES:
+        if tfrom and tfrom not in LANGUAGE_CODES or to not in LANGUAGE_CODES:
             raise ValueError('Invalid language codes')
 
         self.convert_kwargs(locals())