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
+5 -2
View File
@@ -213,8 +213,11 @@ def get_translation(path, lang, data) -> Translation | None:
### Explicitly out of scope for phase 2
- The machine translation itself: chunking output goes in, translated chunks
come back. A background job writes `trans` entries; this doc only defines
the storage key (`chunk_hash:lang`) and the merge semantics.
come back. The **service API exists**`GET /_api/translate/{lang}` lists
pending items (`{"key", "text", "path", "kind"}`, key = base64 chunk hash),
`POST /_api/translate/{lang}` stores a batch (`{"items": [{key, text}]}`)
into `trans` and maintains `node.langs`; an external service does the
actual translating (gated by the /_api forward-auth like everything else).
- Garbage collection of orphaned chunks/translations (see docs/migrate.md).
- sitemap.xml per-language entries; translated UI chrome; per-language
typographer options; multi-locale date/number formatting.