mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 14:59:34 +01:00
for google translate, error if destination language is 'auto'.
This commit is contained in:
parent
34d91284a5
commit
127b3cfabd
@ -268,6 +268,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)),
|
||||
|
@ -60,6 +60,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