Skip to content

Commit 2dbf29d

Browse files
committed
perf: default language
1 parent 332d47d commit 2dbf29d

File tree

8 files changed

+39
-11
lines changed

8 files changed

+39
-11
lines changed

.env

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
VITE_APP_VERSION=0.9.0
2-
VITE_APP_BUILD_NUMBER=11
3-
VITE_APP_RELEASE_DATE=2025-10-15
1+
VITE_APP_VERSION=0.9.1
2+
VITE_APP_BUILD_NUMBER=12
3+
VITE_APP_RELEASE_DATE=2025-10-19

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
**一个简约强大的 SQL 桌面客户端,支持多种文件格式查询**
88

99
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
10-
[![Version](https://img.shields.io/badge/version-0.9.0-blue.svg)](https://github.com/shencangsheng/easydb_app)
10+
[![Version](https://img.shields.io/badge/version-0.9.1-blue.svg)](https://github.com/shencangsheng/easydb_app)
1111
[![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Windows-lightgrey.svg)](https://github.com/shencangsheng/easydb_app)
1212

1313
[English](README_EN.md) | [中文](README.md)

README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
**A simple yet powerful SQL desktop client supporting multiple file formats**
88

99
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
10-
[![Version](https://img.shields.io/badge/version-0.9.0-blue.svg)](https://github.com/shencangsheng/easydb_app)
10+
[![Version](https://img.shields.io/badge/version-0.9.1-blue.svg)](https://github.com/shencangsheng/easydb_app)
1111
[![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Windows-lightgrey.svg)](https://github.com/shencangsheng/easydb_app)
1212

1313
[English](README_EN.md) | [中文](README.md)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "easydb-frontend",
33
"private": true,
4-
"version": "0.9.0",
4+
"version": "0.9.1",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "easydb_app"
3-
version = "0.9.0"
3+
version = "0.9.1"
44
description = "EasyDB APP"
55
authors = ["shencangsheng"]
66
license = "MIT"

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://schema.tauri.app/config/2",
33
"productName": "EasyDB",
4-
"version": "0.9.0",
4+
"version": "0.9.1",
55
"identifier": "com.easydb.app",
66
"build": {
77
"frontendDist": "../dist",

src/i18n/index.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,12 @@ class I18n {
443443
const savedLanguage = localStorage.getItem("app-language") as Language;
444444
if (savedLanguage && ["zh-CN", "en-US"].includes(savedLanguage)) {
445445
this.currentLanguage = savedLanguage;
446+
} else {
447+
// 如果没有保存的语言设置,根据浏览器默认语言自动选择
448+
const browserLanguage = this.detectBrowserLanguage();
449+
this.currentLanguage = browserLanguage;
450+
// 保存自动检测的语言设置
451+
localStorage.setItem("app-language", browserLanguage);
446452
}
447453
}
448454
this.initialized = true;
@@ -453,6 +459,28 @@ class I18n {
453459
}
454460
}
455461

462+
private detectBrowserLanguage(): Language {
463+
try {
464+
if (typeof window !== "undefined" && window.navigator) {
465+
const browserLang =
466+
window.navigator.language || window.navigator.languages?.[0];
467+
468+
// 检查是否是中文(包括简体中文、繁体中文等)
469+
if (browserLang && browserLang.toLowerCase().includes("zh")) {
470+
return "zh-CN";
471+
}
472+
473+
// 其他情况默认使用英文
474+
return "en-US";
475+
}
476+
} catch (error) {
477+
console.warn("Failed to detect browser language:", error);
478+
}
479+
480+
// 如果检测失败,默认使用中文
481+
return "zh-CN";
482+
}
483+
456484
getLanguage(): Language {
457485
return this.currentLanguage;
458486
}

version.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"version": "0.9.0",
3-
"buildNumber": "11",
4-
"releaseDate": "2025-10-15",
2+
"version": "0.9.1",
3+
"buildNumber": "12",
4+
"releaseDate": "2025-10-19",
55
"description": "EasyDB - 数据库管理工具",
66
"author": "shencangsheng",
77
"repository": "https://github.com/shencangsheng/easydb_app",

0 commit comments

Comments
 (0)