Change the verb from second to third person when replacing charname

This commit is contained in:
Sit Melai 2021-11-22 15:22:34 +01:00
parent 325a92efd2
commit 55a7940181

11
main.py
View file

@ -64,6 +64,12 @@ system_info_categories = [
("R2_INVITE", "Ring invitation"), ("R2_INVITE", "Ring invitation"),
] ]
say_1st_to_3rd_person = {
"Vous": " dit ",
"You": " says",
"Du": " sagt",
}
class GUI: class GUI:
color_regex = re.compile('@\{[A-F0-9]{4}\}') color_regex = re.compile('@\{[A-F0-9]{4}\}')
@ -395,11 +401,12 @@ class GUI:
if line[char_name_start] == '[' and line[char_name_start+2] == ']': if line[char_name_start] == '[' and line[char_name_start+2] == ']':
char_name_start += 3 char_name_start += 3
char_name_end = line.find(':', char_name_start) char_name_end = line.find(':', char_name_start)
char_talks_end = char_name_end
char_name_end -= len(line[:char_name_end].rstrip().split(' ')[-1]) + 1 + (len(line[:char_name_end])-len(line[:char_name_end].rstrip())) char_name_end -= len(line[:char_name_end].rstrip().split(' ')[-1]) + 1 + (len(line[:char_name_end])-len(line[:char_name_end].rstrip()))
char_name = line[char_name_start:char_name_end] char_name = line[char_name_start:char_name_end]
if char_name == "Vous" or char_name == "You" or char_name == "Du": if char_name in say_1st_to_3rd_person:
line = line[:char_name_start] + ' '.join([s.capitalize() for s in self.ent_charname.get().split(' ')]) + line[char_name_end:] line = line[:char_name_start] + ' '.join([s.capitalize() for s in self.ent_charname.get().split(' ')]) + say_1st_to_3rd_person[char_name] + line[char_talks_end:]
line = line[:line.find(' * ')] + line[line.find(' * ')+3:] line = line[:line.find(' * ')] + line[line.find(' * ')+3:]
# channel_name = line[21:line.find(')')] # channel_name = line[21:line.find(')')]