This commit is contained in:
2025-08-06 11:32:29 +08:00
parent 90afd6e520
commit 351a79d54c
21 changed files with 915 additions and 16 deletions

View File

@@ -0,0 +1,27 @@
use tauri::command;
use serde::{Deserialize, Serialize};
use crate::i18n;
#[derive(Debug, Serialize, Deserialize)]
pub struct LanguageSettings {
pub locale: String,
}
#[command]
pub async fn get_current_language() -> Result<String, String> {
Ok(i18n::get_current_locale())
}
#[command]
pub async fn set_language(locale: String) -> Result<(), String> {
i18n::set_locale(&locale)
.map_err(|e| format!("Failed to set language: {}", e))?;
log::info!("Language changed to: {}", locale);
Ok(())
}
#[command]
pub async fn get_supported_languages() -> Result<Vec<String>, String> {
Ok(i18n::SUPPORTED_LOCALES.iter().map(|&s| s.to_string()).collect())
}

View File

@@ -5,3 +5,4 @@ pub mod usage;
pub mod storage;
pub mod slash_commands;
pub mod proxy;
pub mod language;