feat(i18n): order channel list by UI language

This commit is contained in:
zhayujie
2026-06-06 19:00:38 +08:00
parent 3c19614c74
commit 72847e0711

View File

@@ -1046,22 +1046,44 @@ class WebChannel(ChatChannel):
self._cleanup_stale_voice_recordings() self._cleanup_stale_voice_recordings()
# Print available channel types # Print available channel types (ordered by language: prioritize
# locally-popular channels for the current UI language)
logger.info( logger.info(
"[WebChannel] Available channels (edit `channel_type` in config.json to switch, separate multiple with commas):") "[WebChannel] Available channels (edit `channel_type` in config.json to switch, separate multiple with commas):")
logger.info("[WebChannel] 1. web - Web") zh_channels = [
logger.info("[WebChannel] 2. terminal - Terminal") ("web", "Web"),
logger.info("[WebChannel] 3. weixin - WeChat") ("terminal", "Terminal"),
logger.info("[WebChannel] 4. feishu - Feishu") ("weixin", "WeChat"),
logger.info("[WebChannel] 5. dingtalk - DingTalk") ("feishu", "Feishu"),
logger.info("[WebChannel] 6. wecom_bot - WeCom Bot") ("dingtalk", "DingTalk"),
logger.info("[WebChannel] 7. wechatcom_app - WeCom App") ("wecom_bot", "WeCom Bot"),
logger.info("[WebChannel] 8. wechat_kf - WeChat Customer Service") ("wechatcom_app", "WeCom App"),
logger.info("[WebChannel] 9. wechatmp - WeChat Official Account") ("wechat_kf", "WeChat Customer Service"),
logger.info("[WebChannel] 10. wechatmp_service - WeChat Official Account (Service)") ("wechatmp", "WeChat Official Account"),
logger.info("[WebChannel] 11. telegram - Telegram") ("wechatmp_service", "WeChat Official Account (Service)"),
logger.info("[WebChannel] 12. slack - Slack") ("telegram", "Telegram"),
logger.info("[WebChannel] 13. discord - Discord") ("slack", "Slack"),
("discord", "Discord"),
]
en_channels = [
("web", "Web"),
("terminal", "Terminal"),
("telegram", "Telegram"),
("slack", "Slack"),
("discord", "Discord"),
("weixin", "WeChat"),
("feishu", "Feishu"),
("dingtalk", "DingTalk"),
("wecom_bot", "WeCom Bot"),
("wechatcom_app", "WeCom App"),
("wechat_kf", "WeChat Customer Service"),
("wechatmp", "WeChat Official Account"),
("wechatmp_service", "WeChat Official Account (Service)"),
]
channels = en_channels if i18n.get_language() == "en" else zh_channels
name_width = max(len(name) for name, _ in channels)
for idx, (name, label) in enumerate(channels, 1):
logger.info(f"[WebChannel] {idx:>2}. {name:<{name_width}} - {label}")
logger.info("[WebChannel] ✅ Web console is running") logger.info("[WebChannel] ✅ Web console is running")
logger.info(f"[WebChannel] 🌐 Local access: http://localhost:{port}") logger.info(f"[WebChannel] 🌐 Local access: http://localhost:{port}")
if is_public_bind: if is_public_bind: