diff --git a/modules/alice.py b/modules/alice.py index 2b16f19..184a9a9 100644 --- a/modules/alice.py +++ b/modules/alice.py @@ -616,5 +616,8 @@ def translateGPT(text, history, fullPromptFlag): extractedTranslations = extractTranslation("\n".join(translatedTextList), False) tList[index] = extractedTranslations - finalList = combineList(tList, text) - return [finalList, totalTokens] + if format == "json": + finalList = combineList(tList, text) + return [finalList, totalTokens] + else: + return [tList[0], totalTokens] diff --git a/modules/anim.py b/modules/anim.py index 002a489..f582c56 100644 --- a/modules/anim.py +++ b/modules/anim.py @@ -575,5 +575,8 @@ def translateGPT(text, history, fullPromptFlag): extractedTranslations = extractTranslation(translatedText, False) tList[index] = extractedTranslations - finalList = combineList(tList, text) - return [finalList, totalTokens] + if format == "json": + finalList = combineList(tList, text) + return [finalList, totalTokens] + else: + return [tList[0], totalTokens] diff --git a/modules/csv.py b/modules/csv.py index a9a64c2..9a3be0b 100644 --- a/modules/csv.py +++ b/modules/csv.py @@ -621,5 +621,8 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") - finalList = combineList(tList, text) - return [finalList, totalTokens] + if format == "json": + finalList = combineList(tList, text) + return [finalList, totalTokens] + else: + return [tList[0], totalTokens] diff --git a/modules/eushully.py b/modules/eushully.py index 12ed04c..8693e01 100644 --- a/modules/eushully.py +++ b/modules/eushully.py @@ -743,5 +743,8 @@ def translateGPT(text, history, fullPromptFlag): extractedTranslations = extractTranslation(translatedText, False) tList[index] = extractedTranslations - finalList = combineList(tList, text) - return [finalList, totalTokens] + if format == "json": + finalList = combineList(tList, text) + return [finalList, totalTokens] + else: + return [tList[0], totalTokens] diff --git a/modules/images.py b/modules/images.py index b2dc2d5..a440b08 100644 --- a/modules/images.py +++ b/modules/images.py @@ -625,5 +625,8 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") - finalList = combineList(tList, text) - return [finalList, totalTokens] + if format == "json": + finalList = combineList(tList, text) + return [finalList, totalTokens] + else: + return [tList[0], totalTokens] diff --git a/modules/irissoft.py b/modules/irissoft.py index ef89332..a9119c6 100644 --- a/modules/irissoft.py +++ b/modules/irissoft.py @@ -759,5 +759,8 @@ def translateGPT(text, history, fullPromptFlag, pbar, filename): extractedTranslations = extractTranslation(translatedText, False) tList[index] = extractedTranslations - finalList = combineList(tList, text) - return [finalList, totalTokens] + if format == "json": + finalList = combineList(tList, text) + return [finalList, totalTokens] + else: + return [tList[0], totalTokens] diff --git a/modules/javascript.py b/modules/javascript.py index 422b56e..2ecca25 100644 --- a/modules/javascript.py +++ b/modules/javascript.py @@ -533,5 +533,8 @@ def translateGPT(text, history, fullPromptFlag, pbar): extractedTranslations = extractTranslation(translatedText, False) tList[index] = extractedTranslations - finalList = combineList(tList, text) - return [finalList, totalTokens] + if format == "json": + finalList = combineList(tList, text) + return [finalList, totalTokens] + else: + return [tList[0], totalTokens] diff --git a/modules/json.py b/modules/json.py index e4859b8..ba0a9ab 100644 --- a/modules/json.py +++ b/modules/json.py @@ -562,5 +562,8 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") - finalList = combineList(tList, text) - return [finalList, totalTokens] + if format == "json": + finalList = combineList(tList, text) + return [finalList, totalTokens] + else: + return [tList[0], totalTokens] diff --git a/modules/kansen.py b/modules/kansen.py index 1bc5069..0219ef9 100644 --- a/modules/kansen.py +++ b/modules/kansen.py @@ -713,5 +713,8 @@ def translateGPT(text, history, fullPromptFlag): extractedTranslations = extractTranslation("\n".join(translatedTextList), False) tList[index] = extractedTranslations - finalList = combineList(tList, text) - return [finalList, totalTokens] + if format == "json": + finalList = combineList(tList, text) + return [finalList, totalTokens] + else: + return [tList[0], totalTokens] diff --git a/modules/kirikiri.py b/modules/kirikiri.py index 5002dd6..cbe1241 100644 --- a/modules/kirikiri.py +++ b/modules/kirikiri.py @@ -605,5 +605,8 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") - finalList = combineList(tList, text) - return [finalList, totalTokens] + if format == "json": + finalList = combineList(tList, text) + return [finalList, totalTokens] + else: + return [tList[0], totalTokens] diff --git a/modules/lune.py b/modules/lune.py index 9891351..aac0cdc 100644 --- a/modules/lune.py +++ b/modules/lune.py @@ -593,5 +593,8 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") - finalList = combineList(tList, text) - return [finalList, totalTokens] + if format == "json": + finalList = combineList(tList, text) + return [finalList, totalTokens] + else: + return [tList[0], totalTokens] diff --git a/modules/nscript.py b/modules/nscript.py index ee3754e..881b2d0 100644 --- a/modules/nscript.py +++ b/modules/nscript.py @@ -621,5 +621,8 @@ def translateGPT(text, history, fullPromptFlag): # Ensure we're passing a single string to extractTranslation tList[index] = translatedText.replace("Placeholder Text", "") - finalList = combineList(tList, text) - return [finalList, totalTokens] + if format == "json": + finalList = combineList(tList, text) + return [finalList, totalTokens] + else: + return [tList[0], totalTokens] diff --git a/modules/regex.py b/modules/regex.py index 1ca3bd0..94b2a2d 100644 --- a/modules/regex.py +++ b/modules/regex.py @@ -195,7 +195,7 @@ def translateRegex(data, translatedList): match = re.search(titleRegex, data[i]) if match: response = translateGPT( - [match.group(1)], + match.group(1), f"Reply with the {LANGUAGE} translation of the chapter title", True, ) @@ -204,8 +204,8 @@ def translateRegex(data, translatedList): title = response[0] # Set - if translatedList: - title = re.sub(r"(?