🚚 Antes DEFAULT_LANGID, ahora LANGID, a secas

This commit is contained in:
Manuel Cillero 2023-06-04 01:02:09 +02:00
parent 520d3bb20b
commit 3886a27e8a
3 changed files with 7 additions and 7 deletions

View file

@ -34,7 +34,7 @@ impl Application {
LazyStatic::force(&trace::TRACING);
// Valida el identificador global de idioma.
LazyStatic::force(&locale::DEFAULT_LANGID);
LazyStatic::force(&locale::LANGID);
#[cfg(feature = "database")]
// Conecta con la base de datos.

View file

@ -1,13 +1,13 @@
use crate::core::module::{all::theme_by_single_name, ThemeStaticRef};
use crate::html::{html, Assets, IdentifierValue, JavaScript, Markup, StyleSheet};
use crate::locale::{LanguageIdentifier, DEFAULT_LANGID};
use crate::locale::{LanguageIdentifier, LANGID};
use crate::server::HttpRequest;
use crate::{concat_string, config, util, LazyStatic};
use std::collections::HashMap;
use std::str::FromStr;
static DEFAULT_THEME: LazyStatic<ThemeStaticRef> =
static THEME: LazyStatic<ThemeStaticRef> =
LazyStatic::new(|| match theme_by_single_name(&config::SETTINGS.app.theme) {
Some(theme) => theme,
None => &crate::core::basic::Basic,
@ -38,8 +38,8 @@ impl Default for RenderContext {
#[rustfmt::skip]
fn default() -> Self {
RenderContext {
langid : &DEFAULT_LANGID,
theme : *DEFAULT_THEME,
langid : &LANGID,
theme : *THEME,
request : None,
stylesheets: Assets::<StyleSheet>::new(),
javascripts: Assets::<JavaScript>::new(),
@ -60,7 +60,7 @@ impl RenderContext {
self.langid = langid;
}
ContextOp::Theme(theme_name) => {
self.theme = theme_by_single_name(theme_name).unwrap_or(*DEFAULT_THEME);
self.theme = theme_by_single_name(theme_name).unwrap_or(*THEME);
}
ContextOp::Request(request) => {
self.request = request;

View file

@ -105,7 +105,7 @@ static FALLBACK_LANGID: LazyStatic<LanguageIdentifier> = LazyStatic::new(|| lang
/// Almacena el Identificador de Idioma Unicode
/// ([Unicode Language Identifier](https://unicode.org/reports/tr35/tr35.html#Unicode_language_identifier))
/// global para la aplicación a partir de `SETTINGS.app.language`.
pub(crate) static DEFAULT_LANGID: LazyStatic<&LanguageIdentifier> =
pub(crate) static LANGID: LazyStatic<&LanguageIdentifier> =
LazyStatic::new(|| langid_for(config::SETTINGS.app.language.as_str()));
pub fn langid_for(language: &str) -> &LanguageIdentifier {