This commit is contained in:
rustdesk 2023-03-03 11:36:12 +08:00
parent ef62869bcc
commit 968b3642a9
2 changed files with 51 additions and 49 deletions

View File

@ -1,6 +1,6 @@
use serde_json::{json, value::Value};
use std::ops::Deref; use std::ops::Deref;
mod ca;
mod cn; mod cn;
mod cs; mod cs;
mod da; mod da;
@ -8,35 +8,32 @@ mod de;
mod en; mod en;
mod eo; mod eo;
mod es; mod es;
mod fa;
mod fr; mod fr;
mod gr;
mod hu; mod hu;
mod id; mod id;
mod it; mod it;
mod ja; mod ja;
mod ko; mod ko;
mod kz;
mod nl; mod nl;
mod pl; mod pl;
mod ptbr; mod ptbr;
mod ro; mod ro;
mod ru; mod ru;
mod sk; mod sk;
mod tr; mod sl;
mod tw;
mod vn;
mod kz;
mod ua;
mod fa;
mod ca;
mod gr;
mod sv;
mod sq; mod sq;
mod sr; mod sr;
mod sv;
mod th; mod th;
mod sl; mod tr;
mod tw;
mod ua;
mod vn;
lazy_static::lazy_static! { pub const LANGS: &[(&str, &str)] = &[
pub static ref LANGS: Value =
json!(vec![
("en", "English"), ("en", "English"),
("it", "Italiano"), ("it", "Italiano"),
("fr", "Français"), ("fr", "Français"),
@ -69,8 +66,7 @@ lazy_static::lazy_static! {
("th", "ภาษาไทย"), ("th", "ภาษาไทย"),
("sl", "Slovenščina"), ("sl", "Slovenščina"),
("ro", "Română"), ("ro", "Română"),
]); ];
}
#[cfg(not(any(target_os = "android", target_os = "ios")))] #[cfg(not(any(target_os = "android", target_os = "ios")))]
pub fn translate(name: String) -> String { pub fn translate(name: String) -> String {

View File

@ -636,7 +636,13 @@ pub fn get_async_job_status() -> String {
#[inline] #[inline]
pub fn get_langs() -> String { pub fn get_langs() -> String {
crate::lang::LANGS.to_string() use serde_json::json;
let mut x: Vec<(&str, String)> = crate::lang::LANGS
.iter()
.map(|a| (a.0, format!("{} - {}", a.1, a.0)))
.collect();
x.sort_by(|a, b| a.0.cmp(b.0));
json!(x).to_string()
} }
#[inline] #[inline]