feat(translate): pass preserve/untranslatable terms through to endpoint - #24
Open
nadaboulaares wants to merge 1 commit into
Open
nadaboulaares wants to merge 1 commit into
nadaboulaares wants to merge 1 commit into
Conversation
#23 review: marking terms non-translatable belongs on the endpoint client. curriculo-ai getzola#1023/getzola#1133 shipped an optional preserve_terms: list[str] on POST /translate (masked via the ⟦n⟧ machinery, restored verbatim; terms under 3 chars ignored server-side). zola now sends it: - TRANSLATE_PRESERVE_TERMS env var, comma-separated, trimmed, blanks dropped — same per-deployment knob pattern as TRANSLATE_URL/TIMEOUT - TranslateApiClient carries the terms; build_translate_request includes preserve_terms only when non-empty, so the body is byte-identical for callers with no glossary - OpenRouter path unchanged (its prompt already carries GLOSSARY); glossary_ok INV-5 gate unchanged Tests: 152 (2 new: payload carries/omits preserve_terms, env parsing).
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #23 (review: "No way to mark terms as non-translatable yet. That belongs on the endpoint side, not here").
Server side (recon)
preserve_terms: list[str]onPOST /translate, plumbed into the existing⟦n⟧mask/restore ContextVar machinery (not a new mechanism). Also covers the gRPC RPC via sharedtranslate_texts.zola side (this PR)
TranslateApiClientnow carries caller-supplied untranslatables and sends them per request:TRANSLATE_PRESERVE_TERMSenv var (comma-separated, trimmed, blanks dropped) — same knob pattern asTRANSLATE_URL/TRANSLATE_TIMEOUTalready on this client. Keeps the fork generic: terms come from the deployment, not code.{"texts": [...], "target_language": ..., "source_language": "en", "preserve_terms": [...]}— field omitted when empty, so the body stays byte-identical for callers with no glossary.glossary_okINV-5 gate unchanged — caller terms are trusted to the endpoint's mask/restore.Tests
152 (
cargo test --bin zola), 2 new: payload carries/omitspreserve_terms, env parsing trims/drops blanks.Assumption stated: PR #23 is already merged, so this is a fresh branch/PR rather than a push to the merged PR branch.