🔖 [pagetop] release development version 0.0.51
This commit is contained in:
parent
c174ab4889
commit
d0fcd12b81
4 changed files with 51 additions and 37 deletions
10
Cargo.toml
10
Cargo.toml
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "pagetop"
|
name = "pagetop"
|
||||||
version = "0.0.50"
|
version = "0.0.51"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
authors = [
|
authors = [
|
||||||
|
|
@ -40,7 +40,7 @@ sqlite = ["database", "sea-orm/sqlx-sqlite"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = "0.1.77"
|
async-trait = "0.1.77"
|
||||||
chrono = "0.4.33"
|
chrono = "0.4.35"
|
||||||
concat-string = "1.0.1"
|
concat-string = "1.0.1"
|
||||||
figlet-rs = "0.1.5"
|
figlet-rs = "0.1.5"
|
||||||
itoa = "1.0.10"
|
itoa = "1.0.10"
|
||||||
|
|
@ -57,7 +57,7 @@ tracing-appender = "0.2.3"
|
||||||
tracing-subscriber = { version = "0.3.18", features = ["json", "env-filter"] }
|
tracing-subscriber = { version = "0.3.18", features = ["json", "env-filter"] }
|
||||||
tracing-actix-web = "0.7.9"
|
tracing-actix-web = "0.7.9"
|
||||||
|
|
||||||
fluent-templates = "0.8.0"
|
fluent-templates = "0.9.0"
|
||||||
unic-langid = { version = "0.9.4", features = ["macros"] }
|
unic-langid = { version = "0.9.4", features = ["macros"] }
|
||||||
|
|
||||||
actix-web = "4"
|
actix-web = "4"
|
||||||
|
|
@ -79,13 +79,13 @@ optional = true
|
||||||
version = "0.4.1"
|
version = "0.4.1"
|
||||||
|
|
||||||
[dependencies.sea-orm]
|
[dependencies.sea-orm]
|
||||||
version = "0.12.9"
|
version = "0.12.14"
|
||||||
features = ["debug-print", "macros", "runtime-async-std-native-tls"]
|
features = ["debug-print", "macros", "runtime-async-std-native-tls"]
|
||||||
default-features = false
|
default-features = false
|
||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
[dependencies.sea-schema]
|
[dependencies.sea-schema]
|
||||||
version = "0.14.1"
|
version = "0.14.2"
|
||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
#[derive(AutoDefault)]
|
|
||||||
pub struct Error403;
|
pub struct Error403;
|
||||||
|
|
||||||
impl ComponentTrait for Error403 {
|
impl ComponentTrait for Error403 {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Error403::default()
|
Error403
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, _cx: &mut Context) -> PrepareMarkup {
|
fn prepare_component(&self, _cx: &mut Context) -> PrepareMarkup {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
#[derive(AutoDefault)]
|
|
||||||
pub struct Error404;
|
pub struct Error404;
|
||||||
|
|
||||||
impl ComponentTrait for Error404 {
|
impl ComponentTrait for Error404 {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Error404::default()
|
Error404
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, _cx: &mut Context) -> PrepareMarkup {
|
fn prepare_component(&self, _cx: &mut Context) -> PrepareMarkup {
|
||||||
|
|
|
||||||
|
|
@ -217,17 +217,23 @@ impl L10n {
|
||||||
L10nOp::None => None,
|
L10nOp::None => None,
|
||||||
L10nOp::Text(text) => Some(text.to_owned()),
|
L10nOp::Text(text) => Some(text.to_owned()),
|
||||||
L10nOp::Translate(key) => match self.locales {
|
L10nOp::Translate(key) => match self.locales {
|
||||||
Some(locales) => locales.lookup_with_args(
|
Some(locales) => {
|
||||||
langid,
|
if self.args.is_empty() {
|
||||||
key,
|
locales.try_lookup(langid, key)
|
||||||
&self
|
} else {
|
||||||
.args
|
locales.try_lookup_with_args(
|
||||||
.iter()
|
langid,
|
||||||
.fold(HashMap::new(), |mut args, (key, value)| {
|
key,
|
||||||
args.insert(key.to_string(), value.to_owned().into());
|
&self
|
||||||
args
|
.args
|
||||||
}),
|
.iter()
|
||||||
),
|
.fold(HashMap::new(), |mut args, (key, value)| {
|
||||||
|
args.insert(key.to_string(), value.to_owned().into());
|
||||||
|
args
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
None => None,
|
None => None,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -244,23 +250,33 @@ impl ToString for L10n {
|
||||||
L10nOp::None => "".to_owned(),
|
L10nOp::None => "".to_owned(),
|
||||||
L10nOp::Text(text) => text.to_owned(),
|
L10nOp::Text(text) => text.to_owned(),
|
||||||
L10nOp::Translate(key) => match self.locales {
|
L10nOp::Translate(key) => match self.locales {
|
||||||
Some(locales) => locales
|
Some(locales) => {
|
||||||
.lookup_with_args(
|
if self.args.is_empty() {
|
||||||
match key.as_str() {
|
locales.lookup(
|
||||||
LANGUAGE_SET_FAILURE => &LANGID_FALLBACK,
|
match key.as_str() {
|
||||||
_ => &LANGID_DEFAULT,
|
LANGUAGE_SET_FAILURE => &LANGID_FALLBACK,
|
||||||
},
|
_ => &LANGID_DEFAULT,
|
||||||
key,
|
},
|
||||||
&self
|
key,
|
||||||
.args
|
)
|
||||||
.iter()
|
} else {
|
||||||
.fold(HashMap::new(), |mut args, (key, value)| {
|
locales.lookup_with_args(
|
||||||
args.insert(key.to_string(), value.to_owned().into());
|
match key.as_str() {
|
||||||
args
|
LANGUAGE_SET_FAILURE => &LANGID_FALLBACK,
|
||||||
}),
|
_ => &LANGID_DEFAULT,
|
||||||
)
|
},
|
||||||
.unwrap_or(key.to_owned()),
|
key,
|
||||||
None => key.to_owned(),
|
&self
|
||||||
|
.args
|
||||||
|
.iter()
|
||||||
|
.fold(HashMap::new(), |mut args, (key, value)| {
|
||||||
|
args.insert(key.to_string(), value.to_owned().into());
|
||||||
|
args
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None => format!("Unknown localization {}", key),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue