Spacing issues
This commit is contained in:
parent
02c3ec1a89
commit
f93ce41bd8
8 changed files with 38 additions and 37 deletions
|
|
@ -276,7 +276,7 @@ def resubVars(translatedText, allList):
|
||||||
matchList = re.findall(r'<\s?.+?\s?>', translatedText)
|
matchList = re.findall(r'<\s?.+?\s?>', translatedText)
|
||||||
if len(matchList) > 0:
|
if len(matchList) > 0:
|
||||||
for match in matchList:
|
for match in matchList:
|
||||||
text = match.replace(' ', '')
|
text = match.strip()
|
||||||
translatedText = translatedText.replace(match, text)
|
translatedText = translatedText.replace(match, text)
|
||||||
|
|
||||||
# Icons
|
# Icons
|
||||||
|
|
|
||||||
|
|
@ -149,39 +149,40 @@ def translateJSON(data, pbar):
|
||||||
speaker = 'None'
|
speaker = 'None'
|
||||||
|
|
||||||
# Text
|
# Text
|
||||||
if 'text' in item[1]:
|
for text in ['text', 'help1', 'help2', 'help3', 'like', 'message']:
|
||||||
if item[1]['text'] != None:
|
if text in item[1]:
|
||||||
jaString = item[1]['text']
|
if item[1][text] != None:
|
||||||
|
jaString = item[1][text]
|
||||||
|
|
||||||
# Remove any textwrap
|
# Remove any textwrap
|
||||||
if FIXTEXTWRAP == True:
|
if FIXTEXTWRAP == True:
|
||||||
jaString = jaString.replace('\n', '')
|
jaString = jaString.replace('\n', ' ')
|
||||||
|
|
||||||
# Translate
|
# Translate
|
||||||
if jaString != '':
|
if jaString != '':
|
||||||
response = translateGPT(f'{speaker} | {jaString}', textHistory, True)
|
response = translateGPT(f'{speaker} | {jaString}', textHistory, True)
|
||||||
tokens[0] += response[1][0]
|
tokens[0] += response[1][0]
|
||||||
tokens[1] += response[1][1]
|
tokens[1] += response[1][1]
|
||||||
translatedText = response[0]
|
translatedText = response[0]
|
||||||
textHistory.append('\"' + translatedText + '\"')
|
textHistory.append('\"' + translatedText + '\"')
|
||||||
else:
|
else:
|
||||||
translatedText = jaString
|
translatedText = jaString
|
||||||
textHistory.append('\"' + translatedText + '\"')
|
textHistory.append('\"' + translatedText + '\"')
|
||||||
|
|
||||||
# Remove added speaker
|
# Remove added speaker
|
||||||
translatedText = re.sub(r'^.+?\s\|\s?', '', translatedText)
|
translatedText = re.sub(r'^.+?\s\|\s?', '', translatedText)
|
||||||
|
|
||||||
# Textwrap
|
# Textwrap
|
||||||
translatedText = textwrap.fill(translatedText, width=WIDTH)
|
translatedText = textwrap.fill(translatedText, width=WIDTH)
|
||||||
|
|
||||||
# Set Data
|
# Set Data
|
||||||
item[1]['text'] = translatedText
|
item[1][text] = translatedText
|
||||||
|
|
||||||
# Keep textHistory list at length maxHistory
|
# Keep textHistory list at length maxHistory
|
||||||
if len(textHistory) > maxHistory:
|
if len(textHistory) > maxHistory:
|
||||||
textHistory.pop(0)
|
textHistory.pop(0)
|
||||||
currentGroup = []
|
currentGroup = []
|
||||||
pbar.update(1)
|
pbar.update(1)
|
||||||
|
|
||||||
return tokens
|
return tokens
|
||||||
|
|
||||||
|
|
@ -244,7 +245,7 @@ def resubVars(translatedText, allList):
|
||||||
matchList = re.findall(r'\[\s?.+?\s?\]', translatedText)
|
matchList = re.findall(r'\[\s?.+?\s?\]', translatedText)
|
||||||
if len(matchList) > 0:
|
if len(matchList) > 0:
|
||||||
for match in matchList:
|
for match in matchList:
|
||||||
text = match.replace(' ', '')
|
text = match.strip()
|
||||||
translatedText = translatedText.replace(match, text)
|
translatedText = translatedText.replace(match, text)
|
||||||
|
|
||||||
# Icons
|
# Icons
|
||||||
|
|
|
||||||
|
|
@ -420,7 +420,7 @@ def resubVars(translatedText, allList):
|
||||||
matchList = re.findall(r'\[\s?.+?\s?\]', translatedText)
|
matchList = re.findall(r'\[\s?.+?\s?\]', translatedText)
|
||||||
if len(matchList) > 0:
|
if len(matchList) > 0:
|
||||||
for match in matchList:
|
for match in matchList:
|
||||||
text = match.replace(' ', '')
|
text = match.strip()
|
||||||
translatedText = translatedText.replace(match, text)
|
translatedText = translatedText.replace(match, text)
|
||||||
|
|
||||||
# Icons
|
# Icons
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ def translateJSON(data, pbar):
|
||||||
|
|
||||||
# Remove any textwrap
|
# Remove any textwrap
|
||||||
if FIXTEXTWRAP == True:
|
if FIXTEXTWRAP == True:
|
||||||
jaString = jaString.replace('\n', '')
|
jaString = jaString.replace('\n', ' ')
|
||||||
|
|
||||||
# Translate
|
# Translate
|
||||||
if jaString != '':
|
if jaString != '':
|
||||||
|
|
@ -182,7 +182,7 @@ def translateJSON(data, pbar):
|
||||||
if len(textHistory) > maxHistory:
|
if len(textHistory) > maxHistory:
|
||||||
textHistory.pop(0)
|
textHistory.pop(0)
|
||||||
currentGroup = []
|
currentGroup = []
|
||||||
pbar.update(1)
|
pbar.update(1)
|
||||||
|
|
||||||
return tokens
|
return tokens
|
||||||
|
|
||||||
|
|
@ -245,7 +245,7 @@ def resubVars(translatedText, allList):
|
||||||
matchList = re.findall(r'\[\s?.+?\s?\]', translatedText)
|
matchList = re.findall(r'\[\s?.+?\s?\]', translatedText)
|
||||||
if len(matchList) > 0:
|
if len(matchList) > 0:
|
||||||
for match in matchList:
|
for match in matchList:
|
||||||
text = match.replace(' ', '')
|
text = match.strip()
|
||||||
translatedText = translatedText.replace(match, text)
|
translatedText = translatedText.replace(match, text)
|
||||||
|
|
||||||
# Icons
|
# Icons
|
||||||
|
|
|
||||||
|
|
@ -1709,7 +1709,7 @@ def resubVars(translatedText, allList):
|
||||||
matchList = re.findall(r'\[\s?.+?\s?\]', translatedText)
|
matchList = re.findall(r'\[\s?.+?\s?\]', translatedText)
|
||||||
if len(matchList) > 0:
|
if len(matchList) > 0:
|
||||||
for match in matchList:
|
for match in matchList:
|
||||||
text = match.replace(' ', '')
|
text = match.strip()
|
||||||
translatedText = translatedText.replace(match, text)
|
translatedText = translatedText.replace(match, text)
|
||||||
|
|
||||||
# Icons
|
# Icons
|
||||||
|
|
|
||||||
|
|
@ -1704,7 +1704,7 @@ def resubVars(translatedText, allList):
|
||||||
matchList = re.findall(r'\[\s?.+?\s?\]', translatedText)
|
matchList = re.findall(r'\[\s?.+?\s?\]', translatedText)
|
||||||
if len(matchList) > 0:
|
if len(matchList) > 0:
|
||||||
for match in matchList:
|
for match in matchList:
|
||||||
text = match.replace(' ', '')
|
text = match.strip()
|
||||||
translatedText = translatedText.replace(match, text)
|
translatedText = translatedText.replace(match, text)
|
||||||
|
|
||||||
# Icons
|
# Icons
|
||||||
|
|
|
||||||
|
|
@ -263,7 +263,7 @@ def resubVars(translatedText, allList):
|
||||||
matchList = re.findall(r'<\s?.+?\s?>', translatedText)
|
matchList = re.findall(r'<\s?.+?\s?>', translatedText)
|
||||||
if len(matchList) > 0:
|
if len(matchList) > 0:
|
||||||
for match in matchList:
|
for match in matchList:
|
||||||
text = match.replace(' ', '')
|
text = match.strip()
|
||||||
translatedText = translatedText.replace(match, text)
|
translatedText = translatedText.replace(match, text)
|
||||||
|
|
||||||
# Icons
|
# Icons
|
||||||
|
|
|
||||||
|
|
@ -434,7 +434,7 @@ def resubVars(translatedText, allList):
|
||||||
matchList = re.findall(r'\[\s?.+?\s?\]', translatedText)
|
matchList = re.findall(r'\[\s?.+?\s?\]', translatedText)
|
||||||
if len(matchList) > 0:
|
if len(matchList) > 0:
|
||||||
for match in matchList:
|
for match in matchList:
|
||||||
text = match.replace(' ', '')
|
text = match.strip()
|
||||||
translatedText = translatedText.replace(match, text)
|
translatedText = translatedText.replace(match, text)
|
||||||
|
|
||||||
# Icons
|
# Icons
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue