Fix translate
This commit is contained in:
parent
cf912a4a72
commit
0d87a789e0
|
@ -23,14 +23,16 @@ async def translate(client, message):
|
||||||
lang = ' '.join(message.command[1:]).lower()
|
lang = ' '.join(message.command[1:]).lower()
|
||||||
for i in PROBLEM_CODES:
|
for i in PROBLEM_CODES:
|
||||||
if lang.startswith(i):
|
if lang.startswith(i):
|
||||||
src_lang = i
|
lang = lang[len(i) + 1:]
|
||||||
lang = lang[len(i):]
|
|
||||||
if lang:
|
if lang:
|
||||||
dest_lang = lang[1:] or 'en'
|
src_lang = i
|
||||||
|
dest_lang = lang
|
||||||
|
else:
|
||||||
|
dest_lang = i
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
lang = lang.split('-', 1)
|
lang = lang.split('-', 1)
|
||||||
if len(lang) == 1:
|
if len(lang) == 1 or not lang[-1]:
|
||||||
dest_lang = lang.pop(0) or dest_lang
|
dest_lang = lang.pop(0) or dest_lang
|
||||||
else:
|
else:
|
||||||
src_lang, dest_lang = lang
|
src_lang, dest_lang = lang
|
||||||
|
|
Loading…
Reference in New Issue