mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 19:52:54 +01:00
enable google translate to autodetect language with 'auto' fromlang.
This commit is contained in:
parent
f988736ca6
commit
b8f8cec6f5
@ -76,7 +76,8 @@ class Language(registry.OnlySomeStrings):
|
|||||||
'Tamil': 'ta', 'Tagalog': 'tl', 'Telugu': 'te',
|
'Tamil': 'ta', 'Tagalog': 'tl', 'Telugu': 'te',
|
||||||
'Thai': 'th', 'Tibetan': 'bo', 'Turkish': 'tr',
|
'Thai': 'th', 'Tibetan': 'bo', 'Turkish': 'tr',
|
||||||
'Ukranian': 'uk', 'Urdu': 'ur', 'Uzbek': 'uz',
|
'Ukranian': 'uk', 'Urdu': 'ur', 'Uzbek': 'uz',
|
||||||
'Uighur': 'ug', 'Vietnamese': 'vi'}
|
'Uighur': 'ug', 'Vietnamese': 'vi',
|
||||||
|
'Detect language': 'auto'}
|
||||||
validStrings = ['lang_' + s for s in transLangs.values()]
|
validStrings = ['lang_' + s for s in transLangs.values()]
|
||||||
validStrings.append('')
|
validStrings.append('')
|
||||||
def normalize(self, s):
|
def normalize(self, s):
|
||||||
|
@ -266,6 +266,8 @@ class Google(callbacks.PluginRegexp):
|
|||||||
lang.transLangs.keys()))
|
lang.transLangs.keys()))
|
||||||
else:
|
else:
|
||||||
toLang = lang.normalize('lang_'+toLang)[5:]
|
toLang = lang.normalize('lang_'+toLang)[5:]
|
||||||
|
if fromLang == 'auto':
|
||||||
|
fromLang = ''
|
||||||
opts['langpair'] = '%s|%s' % (fromLang, toLang)
|
opts['langpair'] = '%s|%s' % (fromLang, toLang)
|
||||||
fd = utils.web.getUrlFd('%s?%s' % (self._gtranslateUrl,
|
fd = utils.web.getUrlFd('%s?%s' % (self._gtranslateUrl,
|
||||||
urllib.urlencode(opts)),
|
urllib.urlencode(opts)),
|
||||||
|
Loading…
Reference in New Issue
Block a user