fix: comprehensive glossary system audit — 6 critical fixes
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m27s
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:
@@ -187,7 +187,7 @@ async def list_glossaries(
|
||||
id=g.id,
|
||||
name=g.name,
|
||||
source_language=g.source_language or "fr",
|
||||
target_language=getattr(g, "target_language", None) or "en",
|
||||
target_language=getattr(g, "target_language", None) or "multi",
|
||||
terms_count=len(g.terms) if g.terms else 0,
|
||||
created_at=g.created_at,
|
||||
)
|
||||
@@ -596,8 +596,8 @@ async def import_glossary_template(
|
||||
glossary = Glossary(
|
||||
user_id=user.id,
|
||||
name=glossary_name,
|
||||
source_language=template_data.get("source_lang", "fr"),
|
||||
target_language=template_data.get("target_lang", "en"),
|
||||
source_language=template_info.get("source_lang", template_data.get("source_lang", "fr")),
|
||||
target_language=template_info.get("target_lang", template_data.get("target_lang", "multi")),
|
||||
created_at=datetime.now(timezone.utc),
|
||||
updated_at=datetime.now(timezone.utc),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user