mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-12 23:24:35 +01:00
move languages into tauri resources
This commit is contained in:
@@ -3,7 +3,7 @@ pub async fn get_lang(window: tauri::Window, lang: String) -> String {
|
|||||||
let lang = lang.to_lowercase();
|
let lang = lang.to_lowercase();
|
||||||
|
|
||||||
// Send contents of language file back
|
// Send contents of language file back
|
||||||
let contents = match std::fs::read_to_string(format!("../lang/{}.json", lang)) {
|
let contents = match std::fs::read_to_string(format!("./resources/lang/{}.json", lang)) {
|
||||||
Ok(x) => x,
|
Ok(x) => x,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
emit_lang_err(window, format!("Failed to read language file: {}", e));
|
emit_lang_err(window, format!("Failed to read language file: {}", e));
|
||||||
@@ -19,7 +19,7 @@ pub async fn get_languages() -> std::collections::HashMap<String, String> {
|
|||||||
// for each lang file, set the key as the filename and the value as the lang_name contained in the file
|
// for each lang file, set the key as the filename and the value as the lang_name contained in the file
|
||||||
let mut languages = std::collections::HashMap::new();
|
let mut languages = std::collections::HashMap::new();
|
||||||
|
|
||||||
let mut lang_files = std::fs::read_dir("../lang").unwrap();
|
let mut lang_files = std::fs::read_dir("./resources/lang").unwrap();
|
||||||
|
|
||||||
while let Some(entry) = lang_files.next() {
|
while let Some(entry) = lang_files.next() {
|
||||||
let entry = entry.unwrap();
|
let entry = entry.unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user