← All writings

Writing · Ep. 5 · 0x139E–0x1AE7 · Tools

Translating 24,276 messages without starting over

The first full dialogue run stopped after 109 messages. The problem was the é in “café”.

The translation looked reasonable, but the game's character mapping couldn't encode that letter. The response had already arrived. Sending the same Japanese back to the model wouldn't fix the underlying problem, and it would mean paying for work we'd already done.

That was an early lesson in the OreGairu English Patch project. Once I moved beyond a few test lines, I needed a way to keep good results, understand failures and continue from where the work stopped.

In the first article, I followed a message from the game files to an English line on screen. This time, the target was 24,276 pending messages across 511 files, grouped into 853 batches. There were also 160 existing translations that needed to stay unchanged.

Turning a folder of messages into a job

I didn't want to select the same files again every time I reopened the app. Before sending any text, the tool built a plan from the selected, editable dialogue files. It skipped entries that were already translated and saved which records belonged in each batch.

Each planned item carried its source file, record ID and source hash. That gave the returned translation a specific destination. Matching a sentence by its position in a response would be fragile if the model left one out.

The preview showed how many messages remained, how many batches they would form, the selected model and estimated token usage. Saving it created a job that the runner could start or resume. The preview itself didn't send translation requests.

Translation Studio's saved jobs screen during the bulk dialogue run, showing batch states and cumulative progress
An early checkpoint: 657 of 24,276 messages saved across 22 of the original 853 batches. Earlier job records were retained as the runner evolved; the top summary combined their completed work.

Those cancelled rows in the screenshot weren't translations thrown away. Some fixes changed the workflow enough to need a new plan for the remaining messages. The previous jobs and their saved responses stayed available, and the progress summary included the work already completed.

Why send several messages together?

Sending one line per request would repeat a lot of instructions and context. Nearby dialogue also helps make sense of a short reply that would be ambiguous on its own.

The planner grouped messages around scene boundaries, then limited each group by message count and estimated text size. The screenshot shows a ceiling of 40 messages per batch. That didn't mean every request contained 40: longer text and file boundaries could produce smaller groups.

Bigger batches weren't automatically better. If one response was incomplete, a larger group could leave more work to sort out. I needed the runner to remember exactly what it had asked for before it sent anything.

Save the answer before trying to use it

The runner wrote a request marker before sending a batch. When the answer arrived, it saved the raw response before parsing or importing it.

That order mattered. If the process stopped while checking the result, the answer would still be on disk. I could fix the checker and try again locally, without asking the model to translate the batch a second time.

This is what let me recover the “café” response. I added a narrow conversion for unsupported accented Latin letters when their plain-letter equivalents were supported. The tool recorded the change, checked the saved response again and rebuilt the affected file. It didn't need another translation request.

The output of this stage was more than an English sentence. It was a saved translation tied to its source record, with checks showing that the text could be encoded back into the game file.

What if the model only answers half the request?

A later batch asked for 27 messages and got only 16 back.

The request had returned an answer, but the batch wasn't done. Importing the response as if it were complete would leave missing dialogue behind a misleading success count. Repeating all 27 messages would waste the 16 answers already available.

I changed the response format so every expected message ID was a required field, then kept a separate check that the returned IDs matched the plan. The missing 11 messages were requested again. Both responses stayed on disk, and the merged set of 27 went through the normal checks before import.

For that batch, recovery looked like this:

Requested:                 27 messages
Returned and retained:     16 messages
Requested during repair:   11 missing messages
Imported after checks:     27 messages

Later responses sometimes included assistant commentary, stray symbols or repeated garbage. The same principle helped: preserve the valid lines and repair only the unresolved ones, using their original Japanese and nearby context.

“Try again” can mean very different things

Not every failure came from the translated text. Some requests lost their connection. Others returned a response that hit its output limit.

One nine-message batch used up its 8,000-token output allowance while producing malformed output and repeated whitespace. That wasn't a good reason to keep raising the allowance. Recovery split those nine messages into smaller groups of five and four, saved each response and checked the complete set before importing it.

I eventually enabled bounded automatic retries for selected connection and server errors in this run. The policy allowed at most two retries, with waits of 5 and 15 seconds. Those waits made failures less likely to trigger an immediate burst of repeated requests. Authentication and quota errors stopped the run instead.

This didn't remove the uncertainty of a lost response. The retry policy accepted that risk within its limits. Separately, if a restarted recovery stage found a request marker with no saved response, it stopped for investigation rather than assuming it was safe to send again.

What the runner finds

What it does next

A saved response that passes the checks

Reuses it locally

A completed response with some missing or invalid lines

Keeps good candidates and repairs the remaining lines

A known output-limit failure

Uses bounded recovery with smaller groups

An interrupted recovery request with no saved outcome

Stops for investigation

A credential problem, exhausted quota or recovery budget

Reports the blocker and stops

One bad batch shouldn't hold up every other scene

The first recovery attempts stopped the run too often. Each fix got it moving, but another awkward response could block all the unrelated work behind it.

The later runner let independent pending batches continue. Failed batches kept their errors and saved responses in the job, then went through a separate recovery pass. Deferring a failure didn't make it disappear from the totals.

Recovery first reused valid lines from the original and earlier repair responses. It then requested only the remaining lines, trying smaller groups and, when needed, a fallback model. Each stage saved its plan before sending and its response before parsing.

The recovery queue had a separate ceiling of 100 requests and a $5 reservation budget for this run. It reserved room for possible usage before sending. These were recovery limits, not a claim about the final bill, and they weren't silently increased when work failed.

A partly repaired batch could keep its good candidates without being marked complete. Only when every required line passed the checks and the affected files rebuilt successfully did the original batch get imported.

What counted as finished?

A successful API response was only one step. Before saving a batch as complete, the pipeline checked that it had the expected IDs, still matched the source, used supported characters and could rebuild the affected game files. It also rejected obvious problems such as excessive repetition and assistant commentary mixed into dialogue.

The completion audit checked the stored entries, rather than trusting the queue's progress label alone:

  • All 24,276 queued messages were saved and automatically approved.

  • The 160 earlier entries were unchanged.

  • Every new entry had a passed offline rebuild check.

  • No queued batches remained unfinished.

That left 24,436 entries in the translation store at this stage. It covered the supported dialogue queue; later work still had to find choices, save labels and other text outside that scope.

The part I would reuse on another project is the recovery design. Save what was requested, save what came back, and make completion depend on the result actually being usable. When the next failure happens, there should be enough information left to fix it without throwing away everything that already worked.

Once the translations were saved and checked, there was still the question of how to install the changes on my Switch. The next article covers building an update that still needs the original game.