Skip to content

Translate-ahead re-translates slides the doc already has #186

Open

Description

@kcarnold

Problem

TranslateAhead (slideSync.ts) picks an item when any slide is missing in any language. It then calls draftItem (server.ts). draftItem decides what the model must translate by looking only at the library (slideLibrary.toLookup()), not the doc. So every slide that isn't in the library goes to the model again, including slides the doc already has. storeTranslations then throws those results away, because it only fills missing keys (#182).

This happens on every partly covered item:

  • an operator edits one slide in Proclaim, which gives the item a new slidesHash, so the whole item is re-drafted;
  • a slide is shared with an item already translated (a chorus, "Amen");
  • a language is added to SLIDE_TRANSLATION_LANGUAGES.

Before #182 this was the same spend: the fresh drafts overwrote the old ones instead of being dropped. A re-draft is as likely to make a good translation worse as to make a bad one better, so the policy is: only re-translate when someone explicitly asks.

Proposal

Give the translate-ahead path a lookup that checks the library first, then the doc. translateItem (src/slideItemTranslation.ts) already treats a lookup hit as done and uses it as context, so the model would get only the missing slides. /api/translateItem (the review screen's Re-translate) keeps the library-only lookup, because that path is the explicit request.

After this, storeTranslations skips a key only in two cases, both of which it should skip:

  • a reviewer's Save or an agent revision landed while the draft was running;
  • the same slide appears twice in one item.

The doc's entries already hold everything the conversation's set_translations calls produced, so the conversation doesn't need to be searched too.

Relationship

If the library becomes a cache of every draft (see the cross-service cache issue), a library-only lookup covers this and the doc lookup becomes redundant. It's still worth doing first: it's small, and it stops the spend now.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions