from je_editor import english_word_dict

# PyBreeze-specific English translations
pybreeze_english_word_dict = {
    # application name
    "application_name": "PyBreeze",
    # Menubar
    "automation_menu_label": "Automation",
    "install_menu_label": "Install",
    # Normal label
    "run_label": "Run",
    "help_label": "HELP",
    "project_label": "Project",
    # Tab tools menu
    "tab_menu_jupyterlab_tab_name": "JupyterLab",
    # APITestka Menu
    "apitestka_menu_label": "APITestka",
    "apitestka_run_script_label": "Run APITestka Script",
    "apitestka_run_script_with_send_label": "Run APITestka With Send",
    "apitestka_run_multi_script_label": "Run Multi APITestka Script",
    "apitestka_run_multi_script_with_send_label": "Run Multi APITestka Script With Send",
    "apitestka_doc_label": "Open APITestka Doc",
    "apitestka_doc_tab_label": "APITestka Doc",
    "apitestka_github_label": "Open APITestka GitHub",
    "apitestka_github_tab_label": "APITestka GitHub",
    "apitestka_create_project_label": "Create APITestka Project",
    # Autocontrol Menu
    "autocontrol_menu_label": "Autocontrol",
    "autocontrol_run_script_label": "Run Autocontrol Script",
    "autocontrol_run_script_with_send_label": "Run Autocontrol With Send",
    "autocontrol_run_multi_script_label": "Run Multi Autocontrol Script",
    "autocontrol_run_multi_script_with_send_label": "Run Multi Autocontrol Script With Send",
    "autocontrol_doc_label": "Open Autocontrol Doc",
    "autocontrol_doc_tab_label": "Autocontrol Doc",
    "autocontrol_github_label": "Open Autocontrol GitHub",
    "autocontrol_github_tab_label": "Autocontrol GitHub",
    "autocontrol_create_project_label": "Create Autocontrol Project",
    "autocontrol_record_menu_label": "Record",
    "autocontrol_record_start_label": "Record Start",
    "autocontrol_record_stop_label": "Record Stop",
    # File Automation Menu
    "file_automation_menu_label": "FileAutomation",
    "file_automation_run_script_label": "Run FileAutomation Script",
    "file_automation_run_script_with_send_label": "Run FileAutomation With Send",
    "file_automation_run_multi_script_label": "Run Multi FileAutomation Script",
    "file_automation_run_multi_script_with_send_label": "Run Multi FileAutomation Script With Send",
    "file_automation_doc_label": "Open FileAutomation Doc",
    "file_automation_doc_tab_label": "FileAutomation Doc",
    "file_automation_github_label": "Open FileAutomation GitHub",
    "file_automation_github_tab_label": "FileAutomation GitHub",
    "file_automation_create_project_label": "Create FileAutomation Project",
    # Load Density Menu
    "load_density_menu_label": "LoadDensity",
    "load_density_run_script_label": "Run LoadDensity Script",
    "load_density_run_script_with_send_label": "Run LoadDensity With Send",
    "load_density_run_multi_script_label": "Run Multi LoadDensity Script",
    "load_density_run_multi_script_with_send_label": "Run Multi LoadDensity Script With Send",
    "load_density_doc_label": "Open LoadDensity Doc",
    "load_density_doc_tab_label": "LoadDensity Doc",
    "load_density_github_label": "Open LoadDensity GitHub",
    "load_density_github_tab_label": "LoadDensity GitHub",
    "load_density_create_project_label": "Create LoadDensity Project",
    # Mail Thunder Menu
    "mail_thunder_menu_label": "MailThunder",
    "mail_thunder_run_script_label": "Run MailThunder Script",
    "mail_thunder_doc_label": "Open MailThunder Doc",
    "mail_thunder_doc_tab_label": "MailThunder Doc",
    "mail_thunder_github_label": "Open MailThunder GitHub",
    "mail_thunder_github_tab_label": "MailThunder GitHub",
    "mail_thunder_create_project_label": "Create MailThunder Project",
    # Webrunner Menu
    "web_runner_menu_label": "WebRunner",
    "web_runner_run_script_label": "Run WebRunner Script",
    "web_runner_run_script_with_send_label": "Run WebRunner With Send",
    "web_runner_run_multi_script_label": "Run Multi WebRunner Script",
    "web_runner_run_multi_script_with_send_label": "Run Multi WebRunner Script With Send",
    "web_runner_doc_label": "Open WebRunner Doc",
    "web_runner_doc_tab_label": "WebRunner Doc",
    "web_runner_github_label": "Open WebRunner GitHub",
    "web_runner_github_tab_label": "WebRunner GitHub",
    "web_runner_create_project_label": "Create WebRunner Project",
    # Install Menu
    "install_menu_autocontrol": "Install AutoControl",
    "install_menu_apitestka": "Install APITestka",
    "install_menu_loaddensity": "Install LoadDensity",
    "install_menu_webrunner": "Install WebRunner",
    "install_menu_automation_file": "Install Automation File",
    "install_menu_mail_thunder": "Install MailThunder",
    "install_menu_tools_install_menu_label": "Tools",
    "install_menu_tools_install_build_tools": "Install Build Tools",
    # Tools Menu
    "tools_menu_re_edge_gpt_label": "ReEdgeGPT",
    "tools_menu_re_edge_gpt_doc_label": "Open ReEdgeGPT Doc",
    "tools_menu_re_edge_gpt_doc_tab_label": "ReEdgeGPT Doc",
    "tools_menu_re_edge_gpt_github_label": "Open ReEdgeGPT GitHub",
    "tools_menu_re_edge_gpt_github_tab_label": "ReEdgeGPT GitHub",
    # Test Pioneer Menu
    "test_pioneer_label": "TestPioneer",
    "test_pioneer_create_template_label": "Create TestPioneer Yaml template",
    "test_pioneer_run_yaml": "Execute Test Pioneer Yaml",
    "test_pioneer_not_choose_yaml": "Please choose a Yaml file",
    # SSH command widget
    "ssh_command_widget_window_title_ssh_command_widget": "SSH Command Widget",
    "ssh_command_widget_button_label_send_command": "Send",
    "ssh_command_widget_input_placeholder_command_line": "Type command then Enter...",
    "ssh_command_widget_dialog_title_input_error": "Input error",
    "ssh_command_widget_dialog_message_input_error_host_user_required": "Host and username are required.",
    "ssh_command_widget_dialog_title_key_error": "Key error",
    "ssh_command_widget_dialog_message_key_file_not_exist": "Key file does not exist.",
    "ssh_command_widget_error_message_unsupported_private_key": "Unsupported or invalid private key.",
    "ssh_command_widget_error_message_key_auth_failed": "Key auth failed",
    "ssh_command_widget_status_label_connected": "Connected",
    "ssh_command_widget_status_label_disconnected": "Disconnected",
    "ssh_command_widget_log_message_connected": "Connected to",
    "ssh_command_widget_log_message_error": "[Error] ",
    "ssh_command_widget_error_message_decode_failed": "<decode error> ",
    "ssh_command_widget_log_message_channel_closed": "[Channel closed]",
    "ssh_command_widget_error_message_reader_failed": "Reader error",
    "ssh_command_widget_log_message_reader_closed": "Reader closed",
    "ssh_command_widget_error_message_send_failed": "[Send error]",
    "ssh_command_widget_dialog_title_not_connected": "Not connected",
    "ssh_command_widget_dialog_message_not_connected_shell": "SSH shell is not connected.",
    "ssh_command_widget_log_message_disconnect_in_progress": "[Disconnecting...]",
    # SSH File Viewer GUI
    "ssh_file_viewer_dialog_title_list_error": "List error",
    "ssh_file_viewer_dialog_message_list_failed": "Failed to list",
    "ssh_file_viewer_dialog_title_operation_failed": "Operation failed",
    "ssh_file_viewer_dialog_message_operation_failed": "Error",
    "ssh_file_viewer_context_menu_action_refresh": "Refresh",
    "ssh_file_viewer_context_menu_action_create_folder": "Create folder",
    "ssh_file_viewer_context_menu_action_rename": "Rename",
    "ssh_file_viewer_context_menu_action_delete": "Delete",
    "ssh_file_viewer_context_menu_action_download": "Download",
    "ssh_file_viewer_context_menu_action_upload": "Upload to this folder",
    "ssh_file_viewer_log_message_refreshing": "Refreshing current item children (or root)",
    "ssh_file_viewer_dialog_title_no_selection": "No selection",
    "ssh_file_viewer_dialog_message_select_folder_to_create": "Select a folder to create inside.",
    "ssh_file_viewer_dialog_title_create_folder": "Create folder",
    "ssh_file_viewer_dialog_label_folder_name": "Folder name:",
    "ssh_file_viewer_dialog_title_rename": "Rename",
    "ssh_file_viewer_dialog_label_new_name_for_item": "New name for",
    "ssh_file_viewer_dialog_title_confirm_delete": "Confirm delete",
    "ssh_file_viewer_dialog_message_confirm_delete": "Delete",
    "ssh_file_viewer_dialog_title_invalid_selection": "Invalid selection",
    "ssh_file_viewer_dialog_message_select_file_to_download": "Select a file to download.",
    "ssh_file_viewer_dialog_title_save_as": "Save as",
    "ssh_file_viewer_dialog_title_downloaded": "Downloaded",
    "ssh_file_viewer_dialog_message_saved_to": "Saved to",
    "ssh_file_viewer_dialog_title_select_local_file": "Select local file to upload",
    "ssh_file_viewer_dialog_title_uploaded": "Uploaded",
    "ssh_file_viewer_dialog_message_uploaded_to": "Uploaded to",
    "ssh_file_viewer_dialog_label_input_text": "Input text",
    "ssh_file_viewer_dialog_button_ok": "OK",
    "ssh_file_viewer_window_title_file_tree_manager": "SSH File TreeView Manager",
    "ssh_file_viewer_tree_header_name": "Name",
    "ssh_file_viewer_tree_header_type": "Type",
    "ssh_file_viewer_tree_header_size": "Size",
    "ssh_file_viewer_tree_header_path": "Path",
    "ssh_file_viewer_dialog_title_missing_input": "Missing input",
    "ssh_file_viewer_dialog_message_missing_input": "Host, user, and password are required.",
    "ssh_file_viewer_dialog_title_connection_failed": "Connection failed",
    "ssh_file_viewer_dialog_message_connection_failed": "Failed to connect",
    # SSH Login Widget
    "ssh_login_widget_label_host": "Host",
    "ssh_login_widget_label_port": "Port",
    "ssh_login_widget_label_user": "User",
    "ssh_login_widget_label_key": "Key",
    "ssh_login_widget_label_password": "Password",
    "ssh_login_widget_placeholder_host": "Host (e.g., 192.168.0.10)",
    "ssh_login_widget_placeholder_username": "Username",
    "ssh_login_widget_placeholder_password": "Password",
    "ssh_login_widget_placeholder_private_key": "Private key path (.pem/.ppk)",
    "ssh_login_widget_button_use_key_auth": "Use key auth",
    "ssh_login_widget_button_connect": "Connect",
    "ssh_login_widget_button_disconnect": "Disconnect",
    "ssh_login_widget_status_disconnected": "Disconnected",
    # AI Code Review GUI
    "ai_code_review_gui_window_title": "AI Code-Review Client",
    "ai_code_review_gui_label_url": "URL:",
    "ai_code_review_gui_label_method": "Method:",
    "ai_code_review_gui_label_code_to_send": "Code to Send:",
    "ai_code_review_gui_label_response": "Response:",
    "ai_code_review_gui_button_send_request": "Send Request",
    "ai_code_review_gui_button_accept_response": "Accept Response",
    "ai_code_review_gui_button_reject_response": "Reject Response",
    "ai_code_review_gui_message_enter_valid_url": "Please enter a valid URL",
    "ai_code_review_gui_message_url_already_recorded": "This URL is already recorded, still sending request...",
    "ai_code_review_gui_message_new_url_recorded": "New URL recorded, sending request...",
    "ai_code_review_gui_message_unsupported_http_method": "Unsupported HTTP method",
    "ai_code_review_gui_message_error": "Error",
    "ai_code_review_gui_status_accepted": "[Accepted]",
    "ai_code_review_gui_status_rejected": "[Rejected]",
    "ai_code_review_gui_status_save_failed": "Save failed",
    # CoT Prompt Editor
    "cot_prompt_editor_window_title": "CoT Prompt Editor",
    "cot_prompt_editor_groupbox_edit_file_content": "Edit File Content",
    "cot_prompt_editor_button_create_file": "Create File",
    "cot_prompt_editor_button_save_file": "Save",
    "cot_prompt_editor_button_reload_file": "Reload",
    "cot_prompt_editor_msgbox_info_title": "Info",
    "cot_prompt_editor_msgbox_success_title": "Success",
    "cot_prompt_editor_msgbox_error_title": "Error",
    "cot_prompt_editor_msgbox_file_exists": "File {filename} already exists, no need to create",
    "cot_prompt_editor_msgbox_file_created": "File {filename} has been created",
    "cot_prompt_editor_msgbox_file_saved": "File {filename} saved",
    "cot_prompt_editor_msgbox_no_file_selected": "No file selected",
    "cot_prompt_editor_file_not_exist": "(File {filename} does not exist)",
    # Skill Prompt Editor
    "skill_prompt_editor_window_title": "Skill Prompt Editor",
    "skill_prompt_editor_groupbox_edit_file_content": "Edit File Content",
    "skill_prompt_editor_button_create_file": "Create File",
    "skill_prompt_editor_button_save_file": "Save",
    "skill_prompt_editor_button_reload_file": "Reload",
    "skill_prompt_editor_msgbox_info_title": "Info",
    "skill_prompt_editor_msgbox_success_title": "Success",
    "skill_prompt_editor_msgbox_error_title": "Error",
    "skill_prompt_editor_msgbox_file_exists": "File {filename} already exists, no need to create",
    "skill_prompt_editor_msgbox_file_created": "File {filename} has been created",
    "skill_prompt_editor_msgbox_file_saved": "File {filename} saved",
    "skill_prompt_editor_msgbox_no_file_selected": "No file selected",
    "skill_prompt_editor_file_not_exist": "(File {filename} does not exist)",
    # Extend Menu
    "extend_tools_menu_tools_menu": "Tools",
    "extend_tools_menu_tools_ssh_menu": "SSH",
    "extend_tools_menu_tools_ai_menu": "AI",
    "extend_tools_menu_ssh_client_tab_action": "SSH Client Tab",
    "extend_tools_menu_ssh_client_tab_label": "SSH Client",
    "extend_tools_menu_ai_code_review_tab_action": "AI Code-Review Tab",
    "extend_tools_menu_ai_code_review_tab_label": "AI Code-Review",
    "extend_tools_menu_cot_prompt_editor_tab_action": "CoT Prompt Editor",
    "extend_tools_menu_cot_prompt_editor_tab_label": "CoT Prompt Editor",
    "extend_tools_menu_skill_prompt_editor_tab_action": "Skill Prompt Editor",
    "extend_tools_menu_skill_prompt_editor_tab_label": "Skill Prompt Editor",
    "extend_tools_menu_skill_prompt_send_tab_label": "Skill Send GUI",
    "extend_tools_menu_dock_ssh_menu": "SSH",
    "extend_tools_menu_dock_ai_menu": "AI",
    "extend_tools_menu_ssh_client_dock_action": "SSH Client Dock",
    "extend_tools_menu_ai_code_review_dock_action": "AI Code-Review Dock",
    "extend_tools_menu_cot_prompt_editor_dock_action": "CoT Prompt Editor Dock",
    "extend_tools_menu_skill_prompt_editor_dock_action": "Skill Prompt Editor Dock",
    "extend_tools_menu_ssh_client_dock_title": "SSH Client",
    "extend_tools_menu_ai_code_review_dock_title": "AI Code-Review",
    "extend_tools_menu_cot_prompt_editor_dock_title": "CoT PromptEditor",
    "extend_tools_menu_skill_prompt_editor_dock_title": "Skill PromptEditor",
    "extend_tools_menu_skill_prompt_send_dock_action": "Skill Prompt Dock",
    "extend_tools_menu_skill_prompt_send_dock_title": "Skill Send GUI",
    # CoT code-review GUI
    "cot_gui_window_title": "Prompt Sender UI",
    "cot_gui_label_api_url": "API URL:",
    "cot_gui_placeholder_api_url": "Please enter the API URL to send, e.g. http://127.0.0.1:5000/api",
    "cot_gui_placeholder_code_paste_area": "You can put the code to be sent",
    "cot_gui_label_prompt_area": "Prompt Area",
    "cot_gui_label_response_area": "Response Area",
    "cot_gui_button_send": "Start Sending",
    "cot_gui_error_read_file": "Unable to read file:",
    "cot_gui_error_no_url": "Please enter the API URL first!",
    "cot_gui_error_sending": "Error sending:",
    # Skills GUI
    "skills_finished_signal": "Success or error message",
    "skills_error_signal": "Exception occurred",
    "skills_error_status": "Error: {status_code}\n{text}",
    "skills_exception": "Exception occurred: {error}",
    "skills_api_url_label": "LLM API URL:",
    "skills_api_url_placeholder": "Enter the API URL to send, e.g. http://127.0.0.1:5000/api",
    "skills_prompt_select_label": "Select Prompt Template:",
    "skills_prompt_label": "Prompt:",
    "skills_send_button": "Send",
    "skills_response_label": "Response:",
    "skills_missing_input": "Please enter API URL and Prompt",
    "skills_generating": "Generating...",
    # JupyterLab GUI
    "jupyterlab_init": "Initializing...",
    "jupyterlab_downloading": "Downloading...",
    "jupyterlab_loading": "Loading...",
    "jupyterlab_timeout": "JupyterLab Timeout",
    "jupyterlab_init_failed": "JupyterLab init failed",
    # Plugin Menu
    "plugin_menu_label": "Plugins",
    "plugin_menu_about": "About",
    "plugin_menu_run_with": "Run with {name}",
    # Run with Menu
    "run_with_menu_label": "Run with...",
    "run_with_suffix_mismatch": "Current file ({suffix}) does not match expected suffixes: {expected}",
    # Plugin Browser
    "plugin_browser_tab_name": "Plugin Browser",
    "plugin_browser_repo_label": "Repository URL:",
    "plugin_browser_fetch_btn": "Fetch Plugins",
    "plugin_browser_col_name": "Plugin",
    "plugin_browser_col_path": "Path",
    "plugin_browser_col_size": "Size",
    "plugin_browser_select_hint": "Select a plugin to view details",
    "plugin_browser_download_btn": "Download && Install",
    "plugin_browser_loading_source": "Loading source code...",
    "plugin_browser_overwrite_title": "Plugin exists",
    "plugin_browser_overwrite_msg": "{name} already exists. Overwrite?",
    "plugin_browser_invalid_url": "Invalid repository URL",
    "plugin_browser_status_ready": "Ready",
    "plugin_browser_status_fetching": "Fetching plugin list...",
    "plugin_browser_status_loaded": "Loaded {count} plugins",
    "plugin_browser_status_downloading": "Downloading {name}...",
    "plugin_browser_status_installed": "Installed: {path}",
    "plugin_browser_restart_hint": "Plugin downloaded to:\n{path}\n\nPlease restart the editor to activate.",
}


def update_english_word_dict():
    # Mutate jeditor's built-in English dict in-place.
    # This works because language_wrapper.language_word_dict is a direct reference
    # to english_word_dict — do NOT use register_natural_language() for built-in
    # languages, as that would replace the reference and break the link.
    english_word_dict.update(pybreeze_english_word_dict)
