🚚 Antes DEFAULT_LANGID, ahora LANGID, a secas
This commit is contained in:
parent
520d3bb20b
commit
3886a27e8a
3 changed files with 7 additions and 7 deletions
|
|
@ -34,7 +34,7 @@ impl Application {
|
||||||
LazyStatic::force(&trace::TRACING);
|
LazyStatic::force(&trace::TRACING);
|
||||||
|
|
||||||
// Valida el identificador global de idioma.
|
// Valida el identificador global de idioma.
|
||||||
LazyStatic::force(&locale::DEFAULT_LANGID);
|
LazyStatic::force(&locale::LANGID);
|
||||||
|
|
||||||
#[cfg(feature = "database")]
|
#[cfg(feature = "database")]
|
||||||
// Conecta con la base de datos.
|
// Conecta con la base de datos.
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
use crate::core::module::{all::theme_by_single_name, ThemeStaticRef};
|
use crate::core::module::{all::theme_by_single_name, ThemeStaticRef};
|
||||||
use crate::html::{html, Assets, IdentifierValue, JavaScript, Markup, StyleSheet};
|
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::server::HttpRequest;
|
||||||
use crate::{concat_string, config, util, LazyStatic};
|
use crate::{concat_string, config, util, LazyStatic};
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
static DEFAULT_THEME: LazyStatic<ThemeStaticRef> =
|
static THEME: LazyStatic<ThemeStaticRef> =
|
||||||
LazyStatic::new(|| match theme_by_single_name(&config::SETTINGS.app.theme) {
|
LazyStatic::new(|| match theme_by_single_name(&config::SETTINGS.app.theme) {
|
||||||
Some(theme) => theme,
|
Some(theme) => theme,
|
||||||
None => &crate::core::basic::Basic,
|
None => &crate::core::basic::Basic,
|
||||||
|
|
@ -38,8 +38,8 @@ impl Default for RenderContext {
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
RenderContext {
|
RenderContext {
|
||||||
langid : &DEFAULT_LANGID,
|
langid : &LANGID,
|
||||||
theme : *DEFAULT_THEME,
|
theme : *THEME,
|
||||||
request : None,
|
request : None,
|
||||||
stylesheets: Assets::<StyleSheet>::new(),
|
stylesheets: Assets::<StyleSheet>::new(),
|
||||||
javascripts: Assets::<JavaScript>::new(),
|
javascripts: Assets::<JavaScript>::new(),
|
||||||
|
|
@ -60,7 +60,7 @@ impl RenderContext {
|
||||||
self.langid = langid;
|
self.langid = langid;
|
||||||
}
|
}
|
||||||
ContextOp::Theme(theme_name) => {
|
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) => {
|
ContextOp::Request(request) => {
|
||||||
self.request = request;
|
self.request = request;
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ static FALLBACK_LANGID: LazyStatic<LanguageIdentifier> = LazyStatic::new(|| lang
|
||||||
/// Almacena el Identificador de Idioma Unicode
|
/// Almacena el Identificador de Idioma Unicode
|
||||||
/// ([Unicode Language Identifier](https://unicode.org/reports/tr35/tr35.html#Unicode_language_identifier))
|
/// ([Unicode Language Identifier](https://unicode.org/reports/tr35/tr35.html#Unicode_language_identifier))
|
||||||
/// global para la aplicación a partir de `SETTINGS.app.language`.
|
/// 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()));
|
LazyStatic::new(|| langid_for(config::SETTINGS.app.language.as_str()));
|
||||||
|
|
||||||
pub fn langid_for(language: &str) -> &LanguageIdentifier {
|
pub fn langid_for(language: &str) -> &LanguageIdentifier {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue