mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-11 01:50:46 +08:00
fix(chat): honor ui_lang on WebSocket turns; ops NE display by host_name
Resolve runtime language from ui_lang and chat.send lang instead of hardcoding zh. Align generalist/ops prompts with user language and require host_name (not ne_id) in ops outputs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
3a467704d6
commit
f1626195f7
12 changed files with 86 additions and 27 deletions
25
tests/test_resolve_runtime_lang.py
Normal file
25
tests/test_resolve_runtime_lang.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
from runtime.lang import resolve_runtime_lang
|
||||
|
||||
|
||||
class ResolveRuntimeLangTests(unittest.TestCase):
|
||||
def test_hint_wins(self) -> None:
|
||||
store = mock.Mock()
|
||||
store.get_setting.return_value = "zh"
|
||||
self.assertEqual(resolve_runtime_lang(store=store, hint="en"), "en")
|
||||
|
||||
def test_store_ui_lang(self) -> None:
|
||||
store = mock.Mock()
|
||||
store.get_setting.return_value = "en"
|
||||
self.assertEqual(resolve_runtime_lang(store=store), "en")
|
||||
|
||||
def test_invalid_falls_back_zh(self) -> None:
|
||||
store = mock.Mock()
|
||||
store.get_setting.return_value = "fr"
|
||||
self.assertEqual(resolve_runtime_lang(store=store), "zh")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue