feat(translation): Post translation columns + settings + migration (#143 step 1)
Post gains post_title_translated / description_translated / translated_source_lang / translation_engine_version / translated_at — filled by the translate sweep so viewing is instant. ImportSettings gains translation_enabled (OFF by default), interpreter_base_url (EMPTY — no default host; the operator points it at their own Interpreter proxy behind a reverse proxy) and translation_target_lang (en), exposed + validated via /settings/import. Migration 0083. Settings defaults + patch + validation test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CDgx8bQS5YrGRK76v8HUnM
This commit is contained in:
@@ -47,6 +47,24 @@ class Post(Base):
|
||||
description: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
attachment_count: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
||||
|
||||
# -- Post-text translation (milestone 143). Filled by the translate_posts
|
||||
# sweep via the Interpreter LAN service so viewing is instant.
|
||||
# translated_source_lang is the DETECTED original language; "en" (or a
|
||||
# passthrough) means nothing to translate and the *_translated columns stay
|
||||
# NULL. engine_version keys the Interpreter cache — re-runs are ~1ms and a
|
||||
# model upgrade re-translates instead of serving stale.
|
||||
post_title_translated: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
description_translated: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
translated_source_lang: Mapped[str | None] = mapped_column(
|
||||
String(8), nullable=True
|
||||
)
|
||||
translation_engine_version: Mapped[str | None] = mapped_column(
|
||||
String(128), nullable=True
|
||||
)
|
||||
translated_at: Mapped[datetime | None] = mapped_column(
|
||||
DateTime(timezone=True), nullable=True
|
||||
)
|
||||
|
||||
downloaded_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), nullable=False, server_default=func.now()
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user