mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-12 21:59:23 +01:00
fix some encoding error for non-ascii langs
This commit is contained in:
parent
34cab7f4c9
commit
f4d47876d4
@ -279,14 +279,14 @@ class Google(callbacks.PluginRegexp):
|
|||||||
if fromLang != '':
|
if fromLang != '':
|
||||||
irc.reply(json['responseData']['translatedText'].encode('utf-8'))
|
irc.reply(json['responseData']['translatedText'].encode('utf-8'))
|
||||||
else:
|
else:
|
||||||
detected_language = json['responseData']['detectedSourceLanguage']
|
detected_language = json['responseData']['detectedSourceLanguage'].encode('utf-8')
|
||||||
|
translation = json['responseData']['translatedText'].encode('utf-8')
|
||||||
try:
|
try:
|
||||||
long_lang_name = [k for k,v in lang.transLangs.iteritems() if v == detected_language][0]
|
long_lang_name = [k for k,v in lang.transLangs.iteritems() if v == detected_language][0]
|
||||||
except IndexError: #just in case google adds langs we don't know about
|
except IndexError: #just in case google adds langs we don't know about
|
||||||
long_lang_name = detected_language
|
long_lang_name = detected_language
|
||||||
responsestring = "(Detected source language: %s) %s" % \
|
responsestring = "(Detected source language: %s) %s" % \
|
||||||
(long_lang_name,
|
(long_lang_name, translation)
|
||||||
json['responseData']['translatedText'].encode('utf-8'))
|
|
||||||
irc.reply(responsestring)
|
irc.reply(responsestring)
|
||||||
translate = wrap(translate, ['something', 'to', 'something', 'text'])
|
translate = wrap(translate, ['something', 'to', 'something', 'text'])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user