fix: glossary selection respects target language — sort by source+target, reset on lang change, fix template import
Some checks failed
Deploy to Production / Build and Deploy (push) Has been cancelled

- GlossarySelector: filteredGlossaries now sorts matching target_language
  first so FR→FA appears before FR→EN when translating to Persian
- GlossarySelector: toggle auto-select prefers glossary matching
  targetLang, falls back to first available
- useTranslationConfig: reset glossaryId when targetLang changes (was
  only resetting on sourceLang change)
- glossary_routes: set target_language from template data on import
  (was missing, defaulted to None/en)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-05-31 22:00:40 +02:00
parent 89c31f8298
commit 5122bfdf99
3 changed files with 15 additions and 5 deletions

View File

@@ -80,10 +80,10 @@ export function useTranslationConfig(hasFile: boolean): UseTranslationConfigRetu
}
}, [settings.defaultTargetLanguage]); // eslint-disable-line react-hooks/exhaustive-deps
// Reset glossary selection when source language changes
// Reset glossary selection when source or target language changes
useEffect(() => {
setGlossaryId(null);
}, [sourceLang]); // eslint-disable-line react-hooks/exhaustive-deps
}, [sourceLang, targetLang]); // eslint-disable-line react-hooks/exhaustive-deps
// Fetch available (admin-configured) providers
useEffect(() => {