From 55a794018152c8c931537017eefe29c5ae0c47f2 Mon Sep 17 00:00:00 2001 From: Sit Melai Date: Mon, 22 Nov 2021 15:22:34 +0100 Subject: [PATCH] Change the verb from second to third person when replacing charname --- main.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 9a23cfa..80b98af 100644 --- a/main.py +++ b/main.py @@ -64,6 +64,12 @@ system_info_categories = [ ("R2_INVITE", "Ring invitation"), ] +say_1st_to_3rd_person = { + "Vous": " dit ", + "You": " says", + "Du": " sagt", +} + class GUI: 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] == ']': char_name_start += 3 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 = line[char_name_start:char_name_end] - if char_name == "Vous" or char_name == "You" or char_name == "Du": - line = line[:char_name_start] + ' '.join([s.capitalize() for s in self.ent_charname.get().split(' ')]) + line[char_name_end:] + 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(' ')]) + say_1st_to_3rd_person[char_name] + line[char_talks_end:] line = line[:line.find(' * ')] + line[line.find(' * ')+3:] # channel_name = line[21:line.find(')')]