🔥 Elimina código para simplificar localización

This commit is contained in:
Manuel Cillero 2023-05-21 00:57:41 +02:00
parent 778e90e8e3
commit 0c385e7080

View file

@ -4,19 +4,10 @@ use crate::core::component::*;
use crate::core::hook::{action_ref, run_actions};
use crate::html::{html, AttributeValue, Classes, ClassesOp, Favicon, Markup, DOCTYPE};
use crate::response::FatalError;
use crate::{config, fn_builder, server, trace, LazyStatic};
use crate::{config, fn_builder, locale, server, trace, LazyStatic};
use std::collections::HashMap;
static DEFAULT_LANGUAGE: LazyStatic<Option<String>> = LazyStatic::new(|| {
let language = config::SETTINGS.app.language[..2].to_lowercase();
if !language.is_empty() {
Some(language)
} else {
None
}
});
static DEFAULT_DIRECTION: LazyStatic<Option<String>> = LazyStatic::new(|| {
let direction = config::SETTINGS.app.direction.to_lowercase();
match direction.as_str() {
@ -60,10 +51,7 @@ impl Default for Page {
#[rustfmt::skip]
fn default() -> Self {
Page {
language : match &*DEFAULT_LANGUAGE {
Some(language) => AttributeValue::new().with_value(language),
_ => AttributeValue::new(),
},
language : AttributeValue::new().with_value(locale::LANGID.language.as_str()),
direction : match &*DEFAULT_DIRECTION {
Some(direction) => AttributeValue::new().with_value(direction),
_ => AttributeValue::new(),