Compare commits

...

2 Commits

Author SHA1 Message Date
5e3fb0098b feat(docker): run glossary translation script automatically on backend container startup
Some checks failed
Deploy to Production / Build and Deploy (push) Has been cancelled
2026-06-28 10:53:58 +02:00
a57b8a8e4d fix(glossaries): normalize language code casing when retrieving display translations 2026-06-28 10:52:08 +02:00
2 changed files with 12 additions and 4 deletions

View File

@@ -49,6 +49,10 @@ except:
# Run database migrations
echo "📦 Running database migrations..."
alembic upgrade head
# Translate and migrate glossaries to multilingual format
echo "🌐 Translating and migrating glossaries to multilingual..."
python scripts/migrate_glossaries_to_multilingual_by_translation.py || echo "⚠️ Glossary translation failed but proceeding..."
fi
# Wait for Redis if configured

View File

@@ -41,9 +41,11 @@ function getDisplaySource(
glossarySourceLang: string
): string {
if (!lang || lang === 'multi') return '';
if (lang === glossarySourceLang) return term.source;
const normalizedLang = lang.toLowerCase();
const normalizedSourceLang = glossarySourceLang.toLowerCase();
if (normalizedLang === normalizedSourceLang) return term.source;
const translations = term.translations || {};
return translations[lang] || '';
return translations[normalizedLang] || '';
}
/** Target term in the chosen language.
@@ -54,9 +56,11 @@ function getDisplayTarget(
glossaryTargetLang: string
): string {
if (!lang) return '';
if (lang === 'multi' || lang === glossaryTargetLang) return term.target;
const normalizedLang = lang.toLowerCase();
const normalizedTargetLang = glossaryTargetLang.toLowerCase();
if (normalizedLang === 'multi' || normalizedLang === normalizedTargetLang) return term.target;
const translations = term.translations || {};
return translations[lang] || '';
return translations[normalizedLang] || '';
}
export default function GlossaryDetailPage() {