Fix the cleanup prompt language and harden detection parsing

Review found the detected language was only switching the glossary rule, not
the base prompt: a detected Turkish recording with an English interface got the
English cleanup prompt with a Turkish glossary footnote. Both now follow the
spoken language, and the detected-language value is guarded against a server
that returns something other than a string. The record reply is covered by a
CLI test.
This commit is contained in:
sudoeren
2026-08-27 21:40:09 +03:00
parent 245f00125e
commit 90ae1690ab
4 changed files with 17 additions and 5 deletions
+4 -2
View File
@@ -264,8 +264,10 @@ class CleanupPrompt(DikteTest):
than the interface language."""
self.write_config({"ui_language": "en", "transcribe_prompt": "Paraşüt"})
conf = cfg.Config()
self.assertIn("KONUŞMACININ KULLANDIĞI İSİM VE TERİMLER",
conf.cleanup_prompt(speech="tr"))
prompt = conf.cleanup_prompt(speech="tr")
self.assertEqual(prompt, cfg.CLEANUP_PROMPT_TR
+ cfg.GLOSSARY_RULE_TR.format(glossary="Paraşüt"))
self.assertIn("KONUŞMACININ KULLANDIĞI İSİM VE TERİMLER", prompt)
self.assertIn("NAMES AND TERMS THE SPEAKER USES",
conf.cleanup_prompt(speech="de"))