From 33e456cfa4cb2aa850946e01e3fee0b0a2a8306d Mon Sep 17 00:00:00 2001 From: TheFlow Date: Sun, 26 Oct 2025 01:56:00 +1300 Subject: [PATCH] fix(i18n): disable card view for translations to show translated content MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: - Card view uses sections array which contains English text - Translated documents showed English content in cards - Only document title was translated Solution: - Set sections = undefined for translated documents - Forces frontend to use traditional full-document view - Traditional view displays content_html which IS translated Result: - Translated documents now show fully translated content - Card view disabled for translations (traditional view instead) - All content (title + body) now displays in German/French Testing: - German: "Einführung in den Tractatus-Rahmen", "Was ist Tractatus?" - content_html confirmed 17KB of translated German text 🌐 Generated with Claude Code Co-Authored-By: Claude --- src/controllers/documents.controller.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/controllers/documents.controller.js b/src/controllers/documents.controller.js index 73596050..3eb1496d 100644 --- a/src/controllers/documents.controller.js +++ b/src/controllers/documents.controller.js @@ -114,20 +114,17 @@ async function getDocument(req, res) { if (document.translations && document.translations[lang]) { const translation = document.translations[lang]; - // TEMPORARY WORKAROUND: Use English sections (markdown structure preserved) - // The DeepL translation mangled markdown formatting, so we use English structure - // but with translated title and content - // TODO: Re-translate with proper markdown preservation settings - const sections = document.sections || []; - - // Return document with translated fields + // WORKAROUND: Don't include sections for translations + // This forces frontend to use traditional full-document view + // which displays the fully translated content_html + // Card view sections are English-only until we fix markdown translation const translatedDoc = { ...document, title: translation.title || document.title, content_html: translation.content_html || document.content_html, content_markdown: translation.content_markdown || document.content_markdown, toc: translation.toc || document.toc, - sections: sections, // Use English sections as workaround + sections: undefined, // Force traditional view (not card view) language: lang, translation_metadata: translation.metadata };