Translator service API: GET/POST /_api/translate/{lang}

This commit is contained in:
2026-09-02 02:16:28 +00:00
parent cc750236bc
commit 10c4c9c4f9
3 changed files with 131 additions and 4 deletions
+6 -1
View File
@@ -91,7 +91,12 @@ alternate links never enumerate chunks. It is written by whoever writes
translation data, in the same transaction:
- **Translator job:** after writing `trans[h][lang]` entries for an
article's chunks (or its title), set `node.langs[lang] = True`.
article's chunks (or its title), set `node.langs[lang] = True`. The
translation service API does both: `GET /_api/translate/{lang}` lists
pending items (titles + translatable chunks lacking an entry, deduped by
hash), `POST /_api/translate/{lang}` stores a batch into `trans`, sets
`langs` on every article that gained an entry and invalidates the page
cache — all in one transaction.
- **Translated-view save:** appending the first patch for `f"{path}:{lang}"`
sets `node.langs[lang] = True` (patches alone make the version exist).
- **Removals:** deleting a patch or GC'ing translations re-derives the key: