Better debug, change check for japanese chars
This commit is contained in:
parent
ea4b17ee40
commit
8aa2fc6a3a
|
@ -85,7 +85,12 @@ def write_translated(outfile, origfile, translation_file_paths):
|
|||
# --- Debug ---
|
||||
global debug_current_line
|
||||
debug_current_line += 1
|
||||
print("\n-", debug_current_line, transfilepath, tokens[0])
|
||||
print(
|
||||
"\n-",
|
||||
debug_current_line,
|
||||
transfilepath,
|
||||
''.join(str(x) for x in tokens),
|
||||
)
|
||||
# -------------
|
||||
|
||||
# Replace the text tokens with the translated ones
|
||||
|
|
|
@ -17,7 +17,16 @@ class ScripterToken():
|
|||
self.type = type
|
||||
|
||||
def __str__(self):
|
||||
return f' |{self.token}|'
|
||||
if self.type == TokenType.TEXT:
|
||||
color = '\033[34m'
|
||||
elif self.type == TokenType.COMMAND:
|
||||
color = '\033[32m'
|
||||
elif self.type == TokenType.COMMENT:
|
||||
color = '\033[36m'
|
||||
return f'{color}{self.token}\033[0m'
|
||||
|
||||
def __repr__(self):
|
||||
return self.__str__()
|
||||
|
||||
|
||||
# Parse and tokenize an Nscripter script line in japanese mode
|
||||
|
@ -84,7 +93,8 @@ def is_double_width(char: str) -> bool:
|
|||
]
|
||||
|
||||
for start, end in japanese_ranges:
|
||||
if start <= ord(char[0]) <= end:
|
||||
#if start <= ord(char[0]) <= end:
|
||||
if 0xFF < ord(char[0]):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
|
Loading…
Reference in New Issue