chinese localization!!
This commit is contained in:
@@ -15,3 +15,7 @@ pub fn init(app_handle: &AppHandle) {
|
||||
control_panel::init(app_handle);
|
||||
tray::init(app_handle);
|
||||
}
|
||||
|
||||
pub fn refresh_locale(app_handle: &AppHandle) {
|
||||
tray::refresh_locale(app_handle);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,10 @@ fn show(handle: &AppHandle, accessibility_only: bool) -> Result<(), String> {
|
||||
};
|
||||
let window =
|
||||
tauri::WebviewWindowBuilder::new(handle, WINDOW_LABEL, WebviewUrl::App(page.into()))
|
||||
.title("Friendolls Setup")
|
||||
.title(crate::settings::text(
|
||||
handle,
|
||||
crate::settings::NativeText::OnboardingTitle,
|
||||
))
|
||||
.inner_size(680.0, 520.0)
|
||||
.min_inner_size(680.0, 520.0)
|
||||
.resizable(false)
|
||||
|
||||
@@ -160,7 +160,10 @@ pub fn open_window(app_handle: &AppHandle) -> Result<tauri::WebviewWindow, Strin
|
||||
WINDOW_LABEL,
|
||||
WebviewUrl::App("/scene".into()),
|
||||
)
|
||||
.title("Scene")
|
||||
.title(crate::settings::text(
|
||||
app_handle,
|
||||
crate::settings::NativeText::SceneTitle,
|
||||
))
|
||||
.inner_size(800.0, 600.0)
|
||||
.resizable(false)
|
||||
.maximizable(false)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use tauri::{
|
||||
AppHandle,
|
||||
AppHandle, Manager, Wry,
|
||||
menu::{Menu, MenuItem},
|
||||
tray::TrayIconBuilder,
|
||||
};
|
||||
@@ -9,17 +9,28 @@ use super::control_panel;
|
||||
const OPEN_CONTROL_PANEL_ID: &str = "open-control-panel";
|
||||
const QUIT_ID: &str = "quit";
|
||||
|
||||
struct TrayMenuState {
|
||||
open_control_panel: MenuItem<Wry>,
|
||||
quit: MenuItem<Wry>,
|
||||
}
|
||||
|
||||
pub fn init(handle: &AppHandle) {
|
||||
let open_control_panel = MenuItem::with_id(
|
||||
handle,
|
||||
OPEN_CONTROL_PANEL_ID,
|
||||
"Open Control Panel",
|
||||
crate::settings::text(handle, crate::settings::NativeText::OpenControlPanel),
|
||||
true,
|
||||
None::<&str>,
|
||||
)
|
||||
.expect("Open Control Panel tray menu item should be created");
|
||||
let quit = MenuItem::with_id(handle, QUIT_ID, "Quit", true, None::<&str>)
|
||||
.expect("Quit tray menu item should be created");
|
||||
let quit = MenuItem::with_id(
|
||||
handle,
|
||||
QUIT_ID,
|
||||
crate::settings::text(handle, crate::settings::NativeText::Quit),
|
||||
true,
|
||||
None::<&str>,
|
||||
)
|
||||
.expect("Quit tray menu item should be created");
|
||||
let menu = Menu::with_items(handle, &[&open_control_panel, &quit])
|
||||
.expect("Tray menu should be created");
|
||||
|
||||
@@ -42,4 +53,22 @@ pub fn init(handle: &AppHandle) {
|
||||
}
|
||||
|
||||
builder.build(handle).expect("Tray icon should be created");
|
||||
handle.manage(TrayMenuState {
|
||||
open_control_panel,
|
||||
quit,
|
||||
});
|
||||
}
|
||||
|
||||
pub fn refresh_locale(handle: &AppHandle) {
|
||||
let Some(items) = handle.try_state::<TrayMenuState>() else {
|
||||
return;
|
||||
};
|
||||
let _ = items.open_control_panel.set_text(crate::settings::text(
|
||||
handle,
|
||||
crate::settings::NativeText::OpenControlPanel,
|
||||
));
|
||||
let _ = items.quit.set_text(crate::settings::text(
|
||||
handle,
|
||||
crate::settings::NativeText::Quit,
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user