fix: glossaries page support for multilingual (target_language='multi')
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m58s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m58s
The /dashboard/glossaries page had two issues: 1. SUPPORTED_LANGUAGES had no 'multi' code, so multilingual glossaries showed '🌐 undefined' instead of '🌐 Multilingue' 2. The Compatible/Autre cible badge compared target_language directly with currentTargetLang, so 'multi' never matched → always showed 'Autre cible'. Now 'multi' is treated as compatible with any target. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -493,9 +493,10 @@ export default function GlossariesPage() {
|
||||
const termCount = glossary.terms_count ?? 0;
|
||||
const srcInfo = SUPPORTED_LANGUAGES.find(l => l.code === glossary.source_language);
|
||||
const tgtInfo = SUPPORTED_LANGUAGES.find(l => l.code === glossary.target_language);
|
||||
const isMultilingual = glossary.target_language === 'multi';
|
||||
// Does this glossary match the current translation target?
|
||||
const matchesTarget = currentTargetLang && glossary.target_language === currentTargetLang;
|
||||
const mismatch = currentTargetLang && glossary.target_language && glossary.target_language !== currentTargetLang;
|
||||
const matchesTarget = currentTargetLang && (isMultilingual || glossary.target_language === currentTargetLang);
|
||||
const mismatch = currentTargetLang && !isMultilingual && glossary.target_language && glossary.target_language !== currentTargetLang;
|
||||
return (
|
||||
<div
|
||||
key={glossary.id}
|
||||
|
||||
@@ -77,6 +77,7 @@ export interface GlossaryUpdateInput {
|
||||
export const MAX_TERMS_PER_GLOSSARY = 500;
|
||||
|
||||
export const SUPPORTED_LANGUAGES: { code: string; label: string; flag: string }[] = [
|
||||
{ code: 'multi', label: 'Multilingue', flag: '🌐' },
|
||||
{ code: 'en', label: 'English', flag: '🇬🇧' },
|
||||
{ code: 'fr', label: 'Français', flag: '🇫🇷' },
|
||||
{ code: 'es', label: 'Español', flag: '🇪🇸' },
|
||||
|
||||
Reference in New Issue
Block a user