Fix encoding issues

This commit is contained in:
Dusk 2024-02-23 15:10:00 +01:00
parent a46f4e1bee
commit c195be34a0
1 changed files with 6 additions and 4 deletions

View File

@ -59,7 +59,7 @@ def swap_line_text(tokens, translation_lines: list[parser.OutputLine]) -> (str,
for token in tokens: for token in tokens:
if token.type == scripter.TokenType.TEXT: if token.type == scripter.TokenType.TEXT:
ret_en += unidecode(translation_lines[lines_written].text_en) ret_en += '`'+unidecode(translation_lines[lines_written].text_en)+'`'
ret_jp += translation_lines[lines_written].text_jp ret_jp += translation_lines[lines_written].text_jp
lines_written += 1 lines_written += 1
else: else:
@ -92,10 +92,9 @@ def write_translated(outfile, origfile, translation_file_paths):
# Remove the lines that have been written # Remove the lines that have been written
structure = structure[lines_written:] structure = structure[lines_written:]
outfile.write('`' + unidecode(line_en) + '\n')
# --- Debug ---
if lines_written > 0: if lines_written > 0:
# --- Debug ---
print( print(
"\n-", "\n-",
debug_current_line, debug_current_line,
@ -105,7 +104,7 @@ def write_translated(outfile, origfile, translation_file_paths):
print(">", line_en) print(">", line_en)
print(">", line_jp) print(">", line_jp)
print("<", line, end='') print("<", line, end='')
# ------------- # -------------
if line_jp+'\n' != line: if line_jp+'\n' != line:
print() print()
@ -114,6 +113,9 @@ def write_translated(outfile, origfile, translation_file_paths):
print(" ------------------------------------------------------") print(" ------------------------------------------------------")
sys.exit(1) sys.exit(1)
# Write the line to the new output
outfile.write(line_en + '\n')
# Used up all of the structures, this chapter has ended. # Used up all of the structures, this chapter has ended.
# Got to the next one # Got to the next one
if len(structure) <= 0: if len(structure) <= 0: