From 365231a4864927b30cd224e4b593c544b9eba245 Mon Sep 17 00:00:00 2001 From: dazedanon Date: Wed, 21 Jan 2026 11:33:09 -0600 Subject: [PATCH] Regex generic --- modules/regex.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/modules/regex.py b/modules/regex.py index 7936efe..2646902 100644 --- a/modules/regex.py +++ b/modules/regex.py @@ -264,8 +264,8 @@ def translateRegex(data, filename, translatedList): if match: jaString = match.group(1) - # Replace \n with > for translation - jaString = jaString.replace('\\n', '>') + # Replace linebreaks + jaString = jaString.replace('\n', ' ') # Pass 1 - Collect for batch translation if not translatedList: @@ -291,11 +291,8 @@ def translateRegex(data, filename, translatedList): # Remove speaker prefix from translation translatedText = re.sub(r"^\[?(.+?)\]?\s?[|:]\s?", "", translatedText) - # Convert > back to \n - translatedText = translatedText.replace('>', '\\n') - - # Escape Quotes - translatedText = translatedText.replace('"', '\\"') + # Textwrap + translatedText = dazedwrap.wrapText(translatedText, width=WIDTH) # Set data[i] = data[i].replace(match.group(1), translatedText)