fix(i18n): disable card view for translations to show translated content

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 <noreply@anthropic.com>
This commit is contained in:
TheFlow 2025-10-26 01:56:00 +13:00
parent 7e612eef3b
commit 33e456cfa4

View file

@ -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
};