♻️ (examples): Extrae las traducciones propias

This commit is contained in:
Manuel Cillero 2026-04-30 06:27:58 +02:00
parent f359b36122
commit 0cf9cebe14
8 changed files with 100 additions and 105 deletions

View file

@ -2,6 +2,8 @@ use pagetop::prelude::*;
use pagetop_bootsier::prelude::*;
include_locales!(LOC from "examples/locale");
struct SuperMenu;
impl Extension for SuperMenu {
@ -14,63 +16,61 @@ impl Extension for SuperMenu {
.with_expand(BreakPoint::LG)
.with_item(navbar::Item::nav(
Nav::new()
.with_item(nav::Item::link(L10n::l("sample_menus_item_link"), |cx| {
.with_item(nav::Item::link(L10n::t("menus_item_link", &LOC), |cx| {
cx.route("/")
}))
.with_item(nav::Item::link_blank(
L10n::l("sample_menus_item_blank"),
L10n::t("menus_item_blank", &LOC),
|_| "https://docs.rs/pagetop".into(),
))
.with_item(nav::Item::dropdown(
Dropdown::new()
.with_title(L10n::l("sample_menus_test_title"))
.with_item(dropdown::Item::header(L10n::l("sample_menus_dev_header")))
.with_title(L10n::t("menus_test_title", &LOC))
.with_item(dropdown::Item::header(L10n::t("menus_dev_header", &LOC)))
.with_item(dropdown::Item::link(
L10n::l("sample_menus_dev_getting_started"),
L10n::t("menus_dev_getting_started", &LOC),
|cx| cx.route("/dev/getting-started"),
))
.with_item(dropdown::Item::link(
L10n::l("sample_menus_dev_guides"),
L10n::t("menus_dev_guides", &LOC),
|cx| cx.route("/dev/guides"),
))
.with_item(dropdown::Item::link_blank(
L10n::l("sample_menus_dev_forum"),
L10n::t("menus_dev_forum", &LOC),
|_| "https://forum.example.dev".into(),
))
.with_item(dropdown::Item::divider())
.with_item(dropdown::Item::header(L10n::l("sample_menus_sdk_header")))
.with_item(dropdown::Item::header(L10n::t("menus_sdk_header", &LOC)))
.with_item(dropdown::Item::link(
L10n::l("sample_menus_sdk_rust"),
L10n::t("menus_sdk_rust", &LOC),
|cx| cx.route("/dev/sdks/rust"),
))
.with_item(dropdown::Item::link(L10n::l("sample_menus_sdk_js"), |cx| {
.with_item(dropdown::Item::link(L10n::t("menus_sdk_js", &LOC), |cx| {
cx.route("/dev/sdks/js")
}))
.with_item(dropdown::Item::link(
L10n::l("sample_menus_sdk_python"),
L10n::t("menus_sdk_python", &LOC),
|cx| cx.route("/dev/sdks/python"),
))
.with_item(dropdown::Item::divider())
.with_item(dropdown::Item::header(L10n::l(
"sample_menus_plugin_header",
)))
.with_item(dropdown::Item::header(L10n::t("menus_plugin_header", &LOC)))
.with_item(dropdown::Item::link(
L10n::l("sample_menus_plugin_auth"),
L10n::t("menus_plugin_auth", &LOC),
|cx| cx.route("/dev/sdks/rust/plugins/auth"),
))
.with_item(dropdown::Item::link(
L10n::l("sample_menus_plugin_cache"),
L10n::t("menus_plugin_cache", &LOC),
|cx| cx.route("/dev/sdks/rust/plugins/cache"),
))
.with_item(dropdown::Item::divider())
.with_item(dropdown::Item::label(L10n::l("sample_menus_item_label")))
.with_item(dropdown::Item::label(L10n::t("menus_item_label", &LOC)))
.with_item(dropdown::Item::link_disabled(
L10n::l("sample_menus_item_disabled"),
L10n::t("menus_item_disabled", &LOC),
|cx| cx.route("#"),
)),
))
.with_item(nav::Item::link_disabled(
L10n::l("sample_menus_item_disabled"),
L10n::t("menus_item_disabled", &LOC),
|cx| cx.route("#"),
)),
))
@ -80,11 +80,10 @@ impl Extension for SuperMenu {
ClassesOp::Add,
classes::Margin::with(Side::Start, ScaleSize::Auto).to_class(),
)
.with_item(nav::Item::link(
L10n::l("sample_menus_item_sign_up"),
|cx| cx.route("/auth/sign-up"),
))
.with_item(nav::Item::link(L10n::l("sample_menus_item_login"), |cx| {
.with_item(nav::Item::link(L10n::t("menus_item_sign_up", &LOC), |cx| {
cx.route("/auth/sign-up")
}))
.with_item(nav::Item::link(L10n::t("menus_item_login", &LOC), |cx| {
cx.route("/auth/login")
})),
));