Closed hsven closed 1 year ago
Can you explain how 45accdc10d8f65e086d2e32b65b60343ac2f3582 fixes text duplication?
Of course, I should have explained it beforehand.
When machinetl.py
processes the JP text, the lineLength
variable is undefined. As such, it's value is checked as None
, which evaluates as True
here.
The called adjustLength
method, from my debugging, adds a line break that duplicates a part of the translation (at least with DeepL, haven't tested with Sugoi).
Example with one of Cafe's lobby lines, taken directly from the extracted file:
舞台の明かりは眩しすぎる…。\r\nもっと暗くすればいいのにと\r\n思います…。
Was being turned to:
舞台の明かりは眩しすぎる…。もっと暗くすればいいのにと\n思います…。
Notice the line break near the end of the line. In DeepL, this results in the following
Without that line break being added, the translation does not have the issue
Tested with both Admire Vega's and Cafe's lobby lines, haven't noticed the issue in neither after the fix.
Thanks, that's a lot more in depth than I expected. Sneaky little bug!
The browser script that integrates with DeepL was fixed, and duplicate text in the MTL process should be now no longer be a problem.
The browser script now also waits for the translated output to be fully retrieved. I noticed that, at least when translating lobby lines, many would get translated with previous lines. Honestly not sure if my solution is satisfactory, would appreciate feedback if there's a better alternative.