fix: show target-language-specific translations in preview + rename migration
Some checks failed
Deploy to Production / Build and Deploy (push) Has been cancelled

Two issues found in screenshot review:
1. Glossary preview always showed English 'target' field (foie → liver)
   instead of the language-specific translation. Now looks up
   term.translations[targetLang] first, falls back to term.target.
   When target is Persian, preview shows 'foie → کبد' (Persian).

2. Previous migration b7c8d9e0f1a2 was already applied on server before
   the rename was added. New migration c8d9e0f1a2b3 handles the rename
   separately: glossaries with target_language='multi' get their name
   changed from 'Anglais' to 'Multilingue'.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-05-31 23:22:50 +02:00
parent a79ce0fc9b
commit b4096fd2ca
4 changed files with 434 additions and 11 deletions

View File

@@ -546,14 +546,18 @@ export function GlossarySelector({ sourceLang, targetLang, isPro, mode, glossary
</div>
) : selectedGlossaryDetail?.terms && selectedGlossaryDetail.terms.length > 0 ? (
<div className="grid grid-cols-1 gap-1 max-h-[120px] overflow-y-auto pr-1">
{selectedGlossaryDetail.terms.slice(0, 4).map((t: any, i: number) => (
{selectedGlossaryDetail.terms.slice(0, 4).map((t: any, i: number) => {
const translations = t.translations || {};
const displayTarget = translations[targetLang] || t.target;
return (
<div key={t.id || i} className="flex justify-between items-center bg-brand-muted/30 dark:bg-white/5 px-2 py-1.5 rounded-md text-xs">
<span className="font-semibold text-brand-dark/75 dark:text-white/70 truncate max-w-[220px]">
{t.source} {t.target}
{t.source} {displayTarget}
</span>
<span className="inline-block w-1.5 h-1.5 bg-brand-accent rounded-full shrink-0" />
</div>
))}
);
})}
{selectedGlossaryDetail.terms.length > 4 && (
<span className="text-[10px] text-brand-dark/40 dark:text-white/40 block text-right font-medium mt-1">
+ {selectedGlossaryDetail.terms.length - 4} autres termes