feat(i18n): localize native tray and app menus

This commit is contained in:
Abeautifulsnow authored and GitHub committed 2026-07-23 19:07:10 +08:00
1 parent b53f700dbe
commit 6115771b34
6 files changed
+219 -15

No files matched your search

+8 -1
View File
@@ -8,7 +8,8 @@ use tauri::{AppHandle, Manager, State, Window};
use super::connection::AppState;
use crate::{
apply_debug_log_level, apply_desktop_settings, hide_main_window_for_close, request_app_close, CloseBehaviorState,
apply_debug_log_level, apply_desktop_settings, hide_main_window_for_close, refresh_native_menus, request_app_close,
AppLocaleState, CloseBehaviorState,
};
const DEVELOPMENT_OPEN_TABS_STATE_KEY: &str = "development_open_tabs";
@@ -57,6 +58,12 @@ pub async fn load_max_agent_turns(state: State<'_, Arc<AppState>>) -> Result<u32
state.storage.load_max_agent_turns().await
}
#[tauri::command]
pub fn set_app_locale(app: AppHandle, locale_state: State<'_, AppLocaleState>, locale: String) -> Result<(), String> {
locale_state.set(locale);
refresh_native_menus(&app).map_err(|err| format!("failed to refresh native menus: {err}"))
}
#[tauri::command]
pub async fn save_max_agent_turns(state: State<'_, Arc<AppState>>, max_agent_turns: u32) -> Result<(), String> {
state.storage.save_max_agent_turns(max_agent_turns).await