rust
Elnu 1 year ago
parent 3abc45cd4f
commit 857832e052

@ -56,14 +56,11 @@ pub fn load_catalogs() -> Result<(Catalogs, Vec<LangCode>), LoadCatalogsError> {
}
let langs = catalogs
.iter()
.map(|(code, catalog)|
LangCode {
.map(|(code, catalog)| LangCode {
code: code.clone(),
name: catalog
.gettext("lang")
.to_owned(),
}
).collect();
name: catalog.gettext("lang").to_owned(),
})
.collect();
Ok((catalogs, langs))
}

@ -2,7 +2,7 @@
extern crate rocket;
use poise::serenity_prelude::Http;
use rocket::{fs::{relative, FileServer}};
use rocket::fs::{relative, FileServer};
use rocket_dyn_templates::{tera, Template};
use sass_rocket_fairing::SassFairing;
use std::{collections::HashMap, env};
@ -58,7 +58,7 @@ async fn rocket() -> _ {
"langs",
move |value: &Value, args: &HashMap<String, Value>| {
langs_filter(value, args, &langs)
}
},
)
}))
.attach(SassFairing::default())

@ -3,7 +3,12 @@ use std::ops::Deref;
use rocket::{http::CookieJar, State};
use rocket_dyn_templates::{context, Template};
use crate::{models::{Challenge, Settings, User}, cookies::LANG_COOKIE, i18n::DEFAULT as DEFAULT_LANG, utils::AcceptLanguage};
use crate::{
cookies::LANG_COOKIE,
i18n::DEFAULT as DEFAULT_LANG,
models::{Challenge, Settings, User},
utils::AcceptLanguage,
};
#[get("/<challenge>")]
pub async fn get_challenge(

Loading…
Cancel
Save