-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from ValgulNecron/dev
Small update
- Loading branch information
Showing
217 changed files
with
3,211 additions
and
2,699 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"En": { | ||
"title": "Here's the avatar of ", | ||
"no_banner_title": "No avatar", | ||
"error_no_user": "Error getting user" | ||
}, | ||
"Fr": { | ||
"title": "Voici l'avatar de ", | ||
"no_banner_title": "Pas d'avatar", | ||
"error_no_user": "Erreur lors de l'obtention de l'utilisateur" | ||
}, | ||
"De": { | ||
"title": "Hier ist das Avatar von ", | ||
"no_banner_title": "Kein Avatar", | ||
"error_no_user": "Fehler beim Abrufen des Benutzers" | ||
}, | ||
"Jp": { | ||
"title": "こちらがのアバターです ", | ||
"no_banner_title": "アバターなし", | ||
"error_no_user": "ユーザーの取得エラー" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
use std::collections::HashMap; | ||
use std::fs::File; | ||
use std::io::Read; | ||
|
||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Debug, Deserialize, Serialize, Clone)] | ||
pub struct AvailableLang { | ||
pub lang: String, | ||
} | ||
|
||
type AvailableLangList = HashMap<String, AvailableLang>; | ||
|
||
impl AvailableLang { | ||
/// Reads and returns a list of available languages from a JSON file. | ||
/// | ||
/// This function opens a file named `available_lang.json` in the `lang_file` directory. | ||
/// After opening the file, it reads the JSON content into a `String`. | ||
/// Finally, it tries to deserialize the JSON content into an `AvailableLangList` object. | ||
/// | ||
/// # Errors | ||
/// | ||
/// If any error occurs while performing these operations, such as: | ||
/// | ||
/// * Error while opening the file. | ||
/// * Error while reading the file. | ||
/// * Error while parsing the JSON content. | ||
/// | ||
/// This function will return a static string describing the error. | ||
/// | ||
/// # Returns | ||
/// | ||
/// A `Result` which is: | ||
/// | ||
/// * `Ok(AvailableLangList)` if all operations completed successfully. | ||
/// * `Err(&'static str)` if any error occurred. | ||
/// | ||
/// # Example | ||
/// | ||
/// ``` | ||
/// use crate::your_module::get_available_lang; | ||
/// | ||
/// match get_available_lang() { | ||
/// Ok(lang_list) => println!("Available languages: {:?}", lang_list), | ||
/// Err(err) => println!("Error: {}", err), | ||
/// } | ||
/// ``` | ||
pub fn get_available_lang() -> Result<AvailableLangList, &'static str> { | ||
let mut file = match File::open("./lang_file/available_lang.json") { | ||
Ok(file) => file, | ||
Err(_) => return Err("Failed to open file"), | ||
}; | ||
|
||
let mut json = String::new(); | ||
|
||
match file.read_to_string(&mut json) { | ||
Ok(_) => {} | ||
Err(_) => return Err("Failed to read file"), | ||
}; | ||
|
||
match serde_json::from_str(&json) { | ||
Ok(data) => Ok(data), | ||
Err(_) => Err("Failed to parse json."), | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.