Added Czech translations to charts. Added logging to actix.
This commit is contained in:
@@ -143,7 +143,21 @@ lazy_static! {
|
||||
("Update title", "Upravit titulek"),
|
||||
("Are you sure you want to delete banner?", "Opravdu chcete smazat banner?"),
|
||||
("Delete banner", "Smazat banner"),
|
||||
("Appearance", "Vzhled")
|
||||
("Appearance", "Vzhled"),
|
||||
("Month bookings", "Rezrvace po měsících"),
|
||||
("Year bookings", "Rezervace po letech"),
|
||||
("January", "Leden"),
|
||||
("February", "Únor"),
|
||||
("March", "Březen"),
|
||||
("April", "Duben"),
|
||||
("May", "Květen"),
|
||||
("June", "Červen"),
|
||||
("July", "Červenec"),
|
||||
("August", "Srpen"),
|
||||
("September", "Září"),
|
||||
("October", "Říjen"),
|
||||
("November", "Listpopad"),
|
||||
("December", "Prosinec"),
|
||||
])),
|
||||
("sk", HashMap::from( [
|
||||
("Dashboard", "Prehlad"),
|
||||
@@ -155,8 +169,30 @@ lazy_static! {
|
||||
};
|
||||
}
|
||||
|
||||
fn get_locales() -> Vec<Option<String>> {
|
||||
#[cfg(not(feature = "ssr"))]
|
||||
{
|
||||
use_context::<Locales>().unwrap_or(Locales(vec![])).0
|
||||
}
|
||||
#[cfg(feature = "ssr")]
|
||||
{
|
||||
use actix_web::HttpRequest;
|
||||
|
||||
let req = use_context::<HttpRequest>();
|
||||
if let Some(r) = req {
|
||||
if let Some(al) = r.head().headers.get("accept-language") {
|
||||
Locales(al.to_str().unwrap_or("").split(",").map(|l| Some(l.to_string())).collect()).0
|
||||
} else {
|
||||
vec![]
|
||||
}
|
||||
} else {
|
||||
vec![]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_dictionary() -> Option<&'static HashMap<&'static str, &'static str>> {
|
||||
let locs = use_context::<Locales>().unwrap_or(Locales(vec![])).0;
|
||||
let locs = get_locales();
|
||||
for loc in locs {
|
||||
if let Some(key) = loc {
|
||||
if let Some(k) = key.split("-").collect::<Vec<_>>().get(0) {
|
||||
|
||||
Reference in New Issue
Block a user