sort langs #2948
This commit is contained in:
parent
ef62869bcc
commit
968b3642a9
28
src/lang.rs
28
src/lang.rs
@ -1,6 +1,6 @@
|
||||
use serde_json::{json, value::Value};
|
||||
use std::ops::Deref;
|
||||
|
||||
mod ca;
|
||||
mod cn;
|
||||
mod cs;
|
||||
mod da;
|
||||
@ -8,35 +8,32 @@ mod de;
|
||||
mod en;
|
||||
mod eo;
|
||||
mod es;
|
||||
mod fa;
|
||||
mod fr;
|
||||
mod gr;
|
||||
mod hu;
|
||||
mod id;
|
||||
mod it;
|
||||
mod ja;
|
||||
mod ko;
|
||||
mod kz;
|
||||
mod nl;
|
||||
mod pl;
|
||||
mod ptbr;
|
||||
mod ro;
|
||||
mod ru;
|
||||
mod sk;
|
||||
mod tr;
|
||||
mod tw;
|
||||
mod vn;
|
||||
mod kz;
|
||||
mod ua;
|
||||
mod fa;
|
||||
mod ca;
|
||||
mod gr;
|
||||
mod sv;
|
||||
mod sl;
|
||||
mod sq;
|
||||
mod sr;
|
||||
mod sv;
|
||||
mod th;
|
||||
mod sl;
|
||||
mod tr;
|
||||
mod tw;
|
||||
mod ua;
|
||||
mod vn;
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref LANGS: Value =
|
||||
json!(vec![
|
||||
pub const LANGS: &[(&str, &str)] = &[
|
||||
("en", "English"),
|
||||
("it", "Italiano"),
|
||||
("fr", "Français"),
|
||||
@ -69,8 +66,7 @@ lazy_static::lazy_static! {
|
||||
("th", "ภาษาไทย"),
|
||||
("sl", "Slovenščina"),
|
||||
("ro", "Română"),
|
||||
]);
|
||||
}
|
||||
];
|
||||
|
||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||
pub fn translate(name: String) -> String {
|
||||
|
@ -636,7 +636,13 @@ pub fn get_async_job_status() -> String {
|
||||
|
||||
#[inline]
|
||||
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]
|
||||
|
Loading…
x
Reference in New Issue
Block a user