fix: Show all sentences contained in response
This commit is contained in:
parent
c7a9b78e73
commit
fb9261e8ef
@ -58,5 +58,8 @@ class GoogleTranslator():
|
||||
# get information block
|
||||
data = eval(targetLine)
|
||||
data = eval(data[0][2])
|
||||
return data[1][0][0][5][0][0]
|
||||
|
||||
ans = []
|
||||
for i in data[1][0][0][5]:
|
||||
ans.append(i[0])
|
||||
return ans
|
||||
|
||||
10
tui.py
10
tui.py
@ -97,11 +97,15 @@ class MainForm(npyscreen.FormBaseNew):
|
||||
# When press ALT + ENTER, send request & update output's text
|
||||
if self.input.value != "":
|
||||
try:
|
||||
targetText = self.translator.translate(self.input.value)
|
||||
targetText = self.translator.translate(self.input.value.replace('\n', ' '))
|
||||
except:
|
||||
targetText = "This is not a true translation, there exist an error."
|
||||
targetText = ["This is not a true translation, there exist an error."]
|
||||
|
||||
finally:
|
||||
self.output.value = targetText
|
||||
text = ""
|
||||
for i in targetText:
|
||||
text = text + i + "\n"
|
||||
self.output.value = text
|
||||
|
||||
# refresh entire form
|
||||
# Though npyscreen's documentation mention that we should avoid using DISPLAY() function
|
||||
|
||||
Loading…
Reference in New Issue
Block a user