Skip to content

Commit 7681b62

Browse files
committed
fix(tauri) - tauri i18n
1 parent 4209d41 commit 7681b62

File tree

8 files changed

+18
-13
lines changed

8 files changed

+18
-13
lines changed

crates/rs-tauri-vue/.eslintrc-auto-import.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@
5656
"watchPostEffect": true,
5757
"watchSyncEffect": true
5858
}
59-
}
59+
}

crates/rs-tauri-vue/src-tauri/locales/en.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
en:
1+
app:
22
app_name: "Tauri+Vue"
33
version: "0.1.0"
44
author: "Henry Huang"

crates/rs-tauri-vue/src-tauri/locales/fr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fr:
1+
app:
22
app_name: "CryptoPie"
33
version: "0.1.0"
44
author: "Henry Huang"

crates/rs-tauri-vue/src-tauri/locales/zh-CN.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
zh-CN:
1+
app:
22
app_name: "数字货币助手"
33
version: "0.1.0"
44
author: "Henry Huang"

crates/rs-tauri-vue/src-tauri/locales/zh-HK.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
zh-HK:
1+
app:
22
app_name: "数字货币助手"
33
version: "0.1.0"
44
author: "Henry Huang"

crates/rs-tauri-vue/src-tauri/src/main.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ fn main() {
3838

3939
// tips:
4040
info!("tauri main started");
41+
info!("app_name: {}", t!("app.app_name").as_str());
42+
info!("description: {}", t!("app.description"));
43+
info!("lang: {}", rust_i18n::locale());
4144

4245
// todo x: 系统托盘菜单
4346
let tray = SystemTray::new().with_menu(menu::tray_menu());
@@ -49,8 +52,8 @@ fn main() {
4952
#[cfg(target_os = "macos")]
5053
let builder = tauri::Builder::default()
5154
// .menu(menu::menu())
52-
.menu(Menu::os_default(t!("app_name").as_str()).add_submenu(Submenu::new(
53-
t!("help"),
55+
.menu(Menu::os_default(t!("app.app_name").as_str()).add_submenu(Submenu::new(
56+
t!("app.help"),
5457
Menu::with_items([
5558
CustomMenuItem::new("Online Documentation", "Online Documentation").into(),
5659
]),

crates/rs-tauri-vue/src-tauri/src/menu/sys.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ pub fn menu() -> Menu {
88

99
fn submenu_app() -> Submenu {
1010
let about_menu = AboutMetadata::new()
11-
.version(t!("version"))
12-
.authors(vec![t!("author")])
13-
.comments(t!("description"))
14-
.copyright(t!("copyright"))
15-
.license(t!("license"))
11+
.version(t!("app.version"))
12+
.authors(vec![t!("app.author")])
13+
.comments(t!("app.description"))
14+
.copyright(t!("app.copyright"))
15+
.license(t!("app.license"))
1616
.website(String::from("https://github.com/better-rs/learn-rs"))
1717
.website_label(String::from("Source Code"));
1818

crates/rs-tauri-vue/src-tauri/tauri.conf.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
"icons/icon.icns",
2626
"icons/icon.ico"
2727
],
28-
"resources": [],
28+
"resources": [
29+
"locales/*"
30+
],
2931
"externalBin": [],
3032
"copyright": "",
3133
"category": "DeveloperTool",

0 commit comments

Comments
 (0)