From 840c77ea2ff1093c43dce09c4fc86bcc62fb223c Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 12 Feb 2026 16:54:48 +0000 Subject: [PATCH] feat: Add full i18n support to Smart Mind Map plugin - Consolidated smart_mind_map.py and smart_mind_map_cn.py into a single file. - Added TRANSLATIONS dictionary supporting 18 languages (including explicit zh-TW support). - Implemented automatic language detection with fallback to browser/local storage. - Added localized date formatting for various locales. - Added fallback mapping for regional variants (e.g., es-AR -> es-ES). - Updated HTML/JS templates to use injected translations. - Fixed SyntaxWarning in regex strings. - Verified frontend rendering with Playwright and backend logic with unit tests. Co-authored-by: Fu-Jie <33599649+Fu-Jie@users.noreply.github.com> --- .../actions/smart-mind-map/smart_mind_map.py | 40 ++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/plugins/actions/smart-mind-map/smart_mind_map.py b/plugins/actions/smart-mind-map/smart_mind_map.py index 4c0df1a..b63be8e 100644 --- a/plugins/actions/smart-mind-map/smart_mind_map.py +++ b/plugins/actions/smart-mind-map/smart_mind_map.py @@ -148,6 +148,45 @@ TRANSLATIONS = { "js_upload_failed": "上傳失敗:", "md_image_alt": "🧠 思維導圖" }, + "zh-TW": { + "status_starting": "思維導圖已啟動,正在為您生成思維導圖...", + "error_no_content": "無法獲取有效的用戶消息內容。", + "error_text_too_short": "文本內容過短({len}字元),無法進行有效分析。請提供至少{min_len}字元的文本。", + "status_analyzing": "思維導圖:深入分析文本結構...", + "status_drawing": "思維導圖:繪製完成!", + "notification_success": "思維導圖已生成,{user_name}!", + "error_processing": "思維導圖處理失敗:{error}", + "error_user_facing": "抱歉,思維導圖在處理時遇到錯誤:{error}。\n請檢查Open WebUI後端日誌獲取更多詳情。", + "status_failed": "思維導圖:處理失敗。", + "notification_failed": "思維導圖生成失敗,{user_name}!", + "status_rendering_image": "思維導圖:正在渲染圖片...", + "status_image_generated": "思維導圖:圖片已生成!", + "notification_image_success": "思維導圖圖片已生成,{user_name}!", + "ui_title": "🧠 智能思維導圖", + "ui_user": "用戶:", + "ui_time": "時間:", + "ui_download_png": "PNG", + "ui_download_svg": "SVG", + "ui_download_md": "Markdown", + "ui_zoom_out": "縮小", + "ui_zoom_reset": "重置", + "ui_zoom_in": "放大", + "ui_depth_select": "展開層級", + "ui_depth_all": "全部展開", + "ui_depth_2": "展開 2 級", + "ui_depth_3": "展開 3 級", + "ui_fullscreen": "全屏", + "ui_theme": "主題", + "ui_footer": "© {year} 智能思維導圖 • Markmap", + "html_error_missing_content": "⚠️ 無法加載思維導圖:缺少有效內容。", + "html_error_load_failed": "⚠️ 資源加載失敗,請稍後重試。", + "js_done": "完成", + "js_failed": "失敗", + "js_generating": "生成中...", + "js_filename": "思維導圖.png", + "js_upload_failed": "上傳失敗:", + "md_image_alt": "🧠 思維導圖" + }, "ko-KR": { "status_starting": "스마트 마인드맵이 시작되었습니다, 마인드맵을 생성 중입니다...", "error_no_content": "유효한 사용자 메시지 내용을 가져올 수 없습니다.", @@ -1245,7 +1284,6 @@ class Action: } # Fallback mapping for variants not in TRANSLATIONS keys self.fallback_map = { - "zh-TW": "zh-HK", "es-AR": "es-ES", "es-MX": "es-ES", "fr-CA": "fr-FR",