Translation: no count for a game sent in one request
Some checks are pending
CI / macos-build (push) Waiting to run
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run

The count jumped from 0 to all; it stays for long games sent in parts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-21 22:33:52 +03:00
parent 3fd98b40da
commit 758d304125
3 changed files with 13 additions and 0 deletions

View file

@ -2,6 +2,11 @@
All notable changes are listed here. Versions follow [Semantic Versioning](https://semver.org/).
## [Unreleased]
- A game whose comments go in one request shows just "Translating…": the count
("12 of 40") is kept for long games sent in several parts.
## [0.8.5] — 2026-10-21
- Translation with a ChatGPT subscription works: the list of models the subscription answers

View file

@ -1113,6 +1113,11 @@ pub struct Job {
const BATCH_CHARS: usize = 5000;
const BATCH_ITEMS: usize = 40;
/// These texts go in one request (then a count "n of total" says nothing).
pub fn one_batch(texts: &[String]) -> bool {
texts.len() <= BATCH_ITEMS && texts.iter().map(|t| t.len()).sum::<usize>() <= BATCH_CHARS
}
impl Job {
pub fn start(
ctx: &egui::Context,

View file

@ -1846,6 +1846,9 @@ impl GameTranslation {
text(ui, trf("The service asks to wait… {s} s", &[("s", &waiting)]).into());
} else if n == 0 && local && now - self.job_started > 8.0 {
text(ui, tr("The model is loading into memory — this can take up to a minute…").into());
} else if self.plan.as_ref().is_some_and(|p| translate::one_batch(&p.texts)) {
// One request: a count would only jump from 0 to all.
text(ui, tr("Translating…").into());
} else {
text(ui, trf("Translating… {n} of {total}", &[("n", &n), ("total", &total)]).into());
}