mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
for google translate, error if destination language is 'auto'.
This commit is contained in:
parent
261a646451
commit
8d45228642
@ -284,6 +284,9 @@ class Google(callbacks.PluginRegexp):
|
||||
toLang = lang.normalize('lang_'+toLang)[5:]
|
||||
if fromLang == 'auto':
|
||||
fromLang = ''
|
||||
if toLang == 'auto':
|
||||
irc.error("Destination language cannot be 'auto'.")
|
||||
return
|
||||
opts['langpair'] = '%s|%s' % (fromLang, toLang)
|
||||
fd = utils.web.getUrlFd('%s?%s' % (self._gtranslateUrl,
|
||||
urllib.urlencode(opts)),
|
||||
|
@ -62,6 +62,7 @@ class GoogleTestCase(ChannelPluginTestCase):
|
||||
def testTranslate(self):
|
||||
self.assertRegexp('translate en es hello world', 'mundo')
|
||||
self.assertRegexp('translate auto en ciao', 'Italian.*hello')
|
||||
self.assertError('translate en to auto stuff')
|
||||
|
||||
def testCalcDoesNotHaveExtraSpaces(self):
|
||||
self.assertNotRegexp('google calc 1000^2', r'\s+,\s+')
|
||||
|
Loading…
Reference in New Issue
Block a user