fix: comprehensive glossary system audit — 6 critical fixes
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m27s

Full audit found 18 issues across backend, frontend, and data files.
Root cause: target_language had no single source of truth — 'en' was
hardcoded as default in 6+ places while templates are actually multilingual.

Fixes applied:
- routes/glossary_routes.py: list_glossaries() fallback 'en' → 'multi'
- routes/glossary_routes.py: import reads target_lang from index.json
  (source of truth) instead of template file
- data/glossaries/*.json: all 8 template files target_lang 'en' → 'multi'
- services/glossary_service.py: get_glossary_terms() now returns
  target_language field (was missing entirely)
- schemas/glossary_schemas.py: all defaults 'en' → 'multi'
  (GlossaryCreate, GlossaryResponse, GlossaryListItem)
- useTranslationConfig.ts: only reset glossary on sourceLang change,
  not targetLang (multilingual glossaries work with any target)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-05-31 23:14:41 +02:00
parent 2386e94c6d
commit a79ce0fc9b
12 changed files with 18 additions and 16 deletions

View File

@@ -47,7 +47,7 @@ class GlossaryCreate(BaseModel):
default="fr", max_length=10, description="Langue source (ISO code)"
)
target_language: str = Field(
default="en", max_length=10, description="Langue cible (ISO code)"
default="multi", max_length=10, description="Langue cible (ISO code) ou 'multi' pour multilingue"
)
terms: list[GlossaryTermCreate] = Field(
default_factory=list, description="Liste des termes"
@@ -79,7 +79,7 @@ class GlossaryResponse(BaseModel):
id: str
name: str
source_language: str = "fr"
target_language: str = "en"
target_language: str = "multi"
terms: list[GlossaryTermResponse] = []
created_at: Optional[datetime] = None
updated_at: Optional[datetime] = None
@@ -93,7 +93,7 @@ class GlossaryListItem(BaseModel):
id: str
name: str
source_language: str = "fr"
target_language: str = "en"
target_language: str = "multi"
terms_count: int = Field(
default=0, description="Nombre de termes dans le glossaire"
)