fix(glossaries): normalize language code casing when retrieving display translations

This commit is contained in:
2026-06-28 10:52:08 +02:00
parent dde80f6bc3
commit a57b8a8e4d

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() {