Skip to content

Commit

Permalink
fix(i18n): tauri's locale data seems to be wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
vgskye committed Feb 13, 2024
1 parent 07e08c8 commit 925549b
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 60 deletions.
50 changes: 0 additions & 50 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ tauri-build = { version = "1.3.0", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.3.0", features = [ "os-all", "shell-open", "dialog-confirm", "http-api", "window-close"] }
tauri = { version = "1.3.0", features = [ "shell-open", "dialog-confirm", "http-api", "window-close"] }
zip = "0.6.6"
tokio = { version = "1", features = [ "fs" ] }
sha2 = "0.10.6"
Expand Down
3 changes: 0 additions & 3 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
},
"shell": {
"open": "^https://fabulously-optimized.gitbook.io/modpack/readme/"
},
"os": {
"all": true
}
},
"bundle": {
Expand Down
7 changes: 1 addition & 6 deletions src/lib/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import { locale as getLocale } from '@tauri-apps/api/os';
import { langs } from './lang';

let locale = navigator.language.split('-')[0];
const locale = navigator.language.split('-')[0];
const defaultLocale = 'en';

getLocale().then((systemLocale) => {
if (systemLocale) locale = systemLocale.split('-')[0];
});

export function trans(id: string, data?: Record<string, string | number | undefined>) {
if (locale && langs[locale] && langs[locale][id]) {
let text = langs[locale][id];
Expand Down

0 comments on commit 925549b

Please sign in to comment.