Añade componentes básicos traducibles Html/Text

This commit is contained in:
Manuel Cillero 2023-05-30 19:13:13 +02:00
parent 6c76e3519c
commit 1d83bbc80a
20 changed files with 243 additions and 369 deletions

View file

@ -34,7 +34,7 @@ impl ModuleTrait for HomeDemo {
async fn demo(request: server::HttpRequest) -> ResultPage<Markup, FatalError> {
Page::new(request)
.with_title(L10n::t("page_title", &LOCALE_DEMOHOME))
.with_title(Text::t("page_title", &LOCALE_DEMOHOME))
.with_context(ContextOp::AddStyleSheet(StyleSheet::located(
"/homedemo/css/styles.css",
)))
@ -55,11 +55,11 @@ fn hello_world() -> Container {
.with_classes(ClassesOp::Add, "hello-col-text")
.with_size(grid::ColumnSize::Is5of12)
.with_component(
Heading::h1(L10n::t("page_title", &LOCALE_DEMOHOME))
Heading::h1(Text::t("page_title", &LOCALE_DEMOHOME))
.with_display(HeadingDisplay::Medium),
)
.with_component(
Paragraph::with(L10n::e("hello_intro", &LOCALE_DEMOHOME).with_arg(
Paragraph::with(Text::e("hello_intro", &LOCALE_DEMOHOME).with_arg(
"app",
format!(
"<span class=\"app-name\">{}</span>",
@ -69,7 +69,7 @@ fn hello_world() -> Container {
.with_display(ParagraphDisplay::Small),
)
.with_component(Paragraph::with(
L10n::e("hello_powered", &LOCALE_DEMOHOME).with_arg(
Text::e("hello_powered", &LOCALE_DEMOHOME).with_arg(
"pagetop",
format!(
"<a href=\"{}\" target=\"_blank\">{}</a>",
@ -80,14 +80,14 @@ fn hello_world() -> Container {
.with_component(
Anchor::button(
"https://github.com/manuelcillero/pagetop",
L10n::t("hello_code", &LOCALE_DEMOHOME),
Text::t("hello_code", &LOCALE_DEMOHOME),
)
.with_target(AnchorTarget::Blank)
.with_left_icon(Icon::with("git"))
.with_classes(ClassesOp::Add, "code-link"),
)
.with_component(
Anchor::link("#welcome", L10n::t("hello_welcome", &LOCALE_DEMOHOME))
Anchor::link("#welcome", Text::t("hello_welcome", &LOCALE_DEMOHOME))
.with_left_icon(Icon::with("arrow-down-circle-fill"))
.with_classes(ClassesOp::Add, "welcome-link"),
),
@ -104,9 +104,9 @@ fn welcome() -> Container {
Container::section()
.with_id("welcome")
.with_classes(ClassesOp::Add, "welcome-col-text")
.with_component(Heading::h2(L10n::t("welcome_page", &LOCALE_DEMOHOME)))
.with_component(Heading::h2(Text::t("welcome_page", &LOCALE_DEMOHOME)))
.with_component(
Heading::h3(L10n::e("welcome_subtitle", &LOCALE_DEMOHOME).with_arg(
Heading::h3(Text::e("welcome_subtitle", &LOCALE_DEMOHOME).with_arg(
"app",
format!(
"<span class=\"app-name\">{}</span>",
@ -116,10 +116,10 @@ fn welcome() -> Container {
.with_display(HeadingDisplay::Subtitle),
)
.with_component(
Paragraph::with(L10n::t("welcome_text1", &LOCALE_DEMOHOME))
Paragraph::with(Text::t("welcome_text1", &LOCALE_DEMOHOME))
.with_display(ParagraphDisplay::Small),
)
.with_component(Paragraph::with(L10n::t("welcome_text2", &LOCALE_DEMOHOME)))
.with_component(Paragraph::with(Text::t("welcome_text2", &LOCALE_DEMOHOME)))
}
fn about_pagetop() -> Container {
@ -134,14 +134,14 @@ fn about_pagetop() -> Container {
.with_column(
grid::Column::new()
.with_classes(ClassesOp::Add, "pagetop-col-text")
.with_component(Heading::h2(L10n::t("pagetop_title", &LOCALE_DEMOHOME)))
.with_component(Heading::h2(Text::t("pagetop_title", &LOCALE_DEMOHOME)))
.with_component(
Paragraph::with(L10n::t("pagetop_text1", &LOCALE_DEMOHOME))
Paragraph::with(Text::t("pagetop_text1", &LOCALE_DEMOHOME))
.with_display(ParagraphDisplay::Small),
)
.with_component(Paragraph::with(L10n::t("pagetop_text2", &LOCALE_DEMOHOME)))
.with_component(Paragraph::with(Text::t("pagetop_text2", &LOCALE_DEMOHOME)))
.with_component(Paragraph::with(
L10n::e("pagetop_text3", &LOCALE_DEMOHOME).with_arg(
Text::e("pagetop_text3", &LOCALE_DEMOHOME).with_arg(
"pagetop_website",
format!(
"<a href=\"{}\" target=\"_blank\">{}</a>",
@ -160,12 +160,12 @@ fn promo_pagetop() -> Container {
.with_column(
grid::Column::new()
.with_classes(ClassesOp::Add, "promo-col-text")
.with_component(Heading::h2(L10n::t(
.with_component(Heading::h2(Text::t(
"pagetop_promo_title",
&LOCALE_DEMOHOME,
)))
.with_component(
Paragraph::with(L10n::e("pagetop_promo_text1", &LOCALE_DEMOHOME).with_arg(
Paragraph::with(Text::e("pagetop_promo_text1", &LOCALE_DEMOHOME).with_arg(
"pagetop",
format!(
"<a href=\"{}\" target=\"_blank\">{}</a>",
@ -196,15 +196,15 @@ fn reporting_issues() -> Container {
grid::Column::new()
.with_classes(ClassesOp::Add, "reporting-col-text")
.with_size(grid::ColumnSize::Is6of12)
.with_component(Heading::h2(L10n::t(
.with_component(Heading::h2(Text::t(
"report_problems_title",
&LOCALE_DEMOHOME,
)))
.with_component(
Paragraph::with(L10n::t("report_problems_text1", &LOCALE_DEMOHOME))
Paragraph::with(Text::t("report_problems_text1", &LOCALE_DEMOHOME))
.with_display(ParagraphDisplay::Small),
)
.with_component(Paragraph::with(L10n::t(
.with_component(Paragraph::with(Text::t(
"report_problems_text2",
&LOCALE_DEMOHOME,
))),