♻️ (locale): Renombra L10n a Lc
Simplifica el nombre del tipo de localización. Actualiza todas las referencias en el crate principal, extensiones, ejemplos y tests.
This commit is contained in:
parent
3198b74399
commit
be10dd28a1
65 changed files with 612 additions and 621 deletions
|
|
@ -16,13 +16,13 @@ pub struct Brand {
|
|||
/// Devuelve la imagen de marca (si la hay).
|
||||
image: Embed<bs::Image>,
|
||||
/// Devuelve el título de la identidad de marca.
|
||||
#[default(_code = "L10n::n(&global::SETTINGS.app.name)")]
|
||||
title: L10n,
|
||||
#[default(_code = "Lc::n(&global::SETTINGS.app.name)")]
|
||||
title: Lc,
|
||||
/// Devuelve el eslogan de la marca.
|
||||
slogan: L10n,
|
||||
/// Devuelve la función que resuelve la URL asociada a la marca (si existe).
|
||||
#[default(_code = "Some(|cx| cx.route(\"/\"))")]
|
||||
route: Option<FnPathByContext>,
|
||||
slogan: Lc,
|
||||
/// Devuelve la ruta asociada a la marca (si existe).
|
||||
#[default(_code = "Some(\"/\".into())")]
|
||||
route: Option<Route>,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
|
|
@ -40,7 +40,7 @@ impl Component for Brand {
|
|||
let slogan = self.slogan().using(cx);
|
||||
Ok(html! {
|
||||
@if let Some(route) = self.route() {
|
||||
a class="navbar-brand" href=(route(cx)) { (image) (title) (slogan) }
|
||||
a class="navbar-brand" href=(route.resolve(cx)) { (image) (title) (slogan) }
|
||||
} @else {
|
||||
span class="navbar-brand" { (image) (title) (slogan) }
|
||||
}
|
||||
|
|
@ -60,21 +60,21 @@ impl Brand {
|
|||
|
||||
/// Establece el título de la identidad de marca.
|
||||
#[builder_fn]
|
||||
pub fn with_title(mut self, title: L10n) -> Self {
|
||||
pub fn with_title(mut self, title: Lc) -> Self {
|
||||
self.title = title;
|
||||
self
|
||||
}
|
||||
|
||||
/// Define el eslogan de la marca.
|
||||
#[builder_fn]
|
||||
pub fn with_slogan(mut self, slogan: L10n) -> Self {
|
||||
pub fn with_slogan(mut self, slogan: Lc) -> Self {
|
||||
self.slogan = slogan;
|
||||
self
|
||||
}
|
||||
|
||||
/// Define la URL de destino. Si es `None`, la marca no será un enlace.
|
||||
/// Define la ruta de destino. Si es `None`, la marca no será un enlace.
|
||||
#[builder_fn]
|
||||
pub fn with_route(mut self, route: Option<FnPathByContext>) -> Self {
|
||||
pub fn with_route(mut self, route: Option<Route>) -> Self {
|
||||
self.route = route;
|
||||
self
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ const TOGGLE_OFFCANVAS: &str = "offcanvas";
|
|||
/// let navbar = bs::Navbar::simple()
|
||||
/// .with_item(bs::navbar::Item::nav(
|
||||
/// bs::Nav::new()
|
||||
/// .with_item(bs::nav::Item::link(L10n::n("Home"), |_| "/".into()))
|
||||
/// .with_item(bs::nav::Item::link(L10n::n("About"), |_| "/about".into()))
|
||||
/// .with_item(bs::nav::Item::link(L10n::n("Contact"), |_| "/contact".into()))
|
||||
/// .with_item(bs::nav::Item::link(Lc::n("Home"), "/"))
|
||||
/// .with_item(bs::nav::Item::link(Lc::n("About"), "/about"))
|
||||
/// .with_item(bs::nav::Item::link(Lc::n("Contact"), "/contact"))
|
||||
/// ));
|
||||
/// ```
|
||||
///
|
||||
|
|
@ -38,12 +38,12 @@ const TOGGLE_OFFCANVAS: &str = "offcanvas";
|
|||
/// # use pagetop::prelude::*;
|
||||
/// # use pagetop_bootsier::theme::*;
|
||||
/// let navbar = bs::Navbar::simple_toggle()
|
||||
/// .with_expand(token::BreakPoint::MD)
|
||||
/// .with_expand(BreakPoint::MD)
|
||||
/// .with_item(bs::navbar::Item::nav(
|
||||
/// bs::Nav::new()
|
||||
/// .with_item(bs::nav::Item::link(L10n::n("Home"), |_| "/".into()))
|
||||
/// .with_item(bs::nav::Item::link_blank(L10n::n("Doc"), |_| "https://docs.rs".into()))
|
||||
/// .with_item(bs::nav::Item::link(L10n::n("Support"), |_| "/support".into()))
|
||||
/// .with_item(bs::nav::Item::link(Lc::n("Home"), "/"))
|
||||
/// .with_item(bs::nav::Item::link_blank(Lc::n("Doc"), "https://docs.rs"))
|
||||
/// .with_item(bs::nav::Item::link(Lc::n("Support"), "/support"))
|
||||
/// ));
|
||||
/// ```
|
||||
///
|
||||
|
|
@ -53,24 +53,24 @@ const TOGGLE_OFFCANVAS: &str = "offcanvas";
|
|||
/// # use pagetop::prelude::*;
|
||||
/// # use pagetop_bootsier::theme::*;
|
||||
/// let brand = bs::navbar::Brand::new()
|
||||
/// .with_title(L10n::n("PageTop"))
|
||||
/// .with_route(Some(|cx| cx.route("/")));
|
||||
/// .with_title(Lc::n("PageTop"))
|
||||
/// .with_route(Some("/".into()));
|
||||
///
|
||||
/// let navbar = bs::Navbar::brand_left(brand)
|
||||
/// .with_item(bs::navbar::Item::nav(
|
||||
/// bs::Nav::new()
|
||||
/// .with_item(bs::nav::Item::link(L10n::n("Home"), |_| "/".into()))
|
||||
/// .with_item(bs::nav::Item::link(Lc::n("Home"), "/"))
|
||||
/// .with_item(bs::nav::Item::dropdown(
|
||||
/// bs::Dropdown::new()
|
||||
/// .with_title(L10n::n("Tools"))
|
||||
/// .with_title(Lc::n("Tools"))
|
||||
/// .with_item(bs::dropdown::Item::link(
|
||||
/// L10n::n("Generator"), |_| "/tools/gen".into())
|
||||
/// Lc::n("Generator"), "/tools/gen")
|
||||
/// )
|
||||
/// .with_item(bs::dropdown::Item::link(
|
||||
/// L10n::n("Reports"), |_| "/tools/reports".into())
|
||||
/// Lc::n("Reports"), "/tools/reports")
|
||||
/// )
|
||||
/// ))
|
||||
/// .with_item(bs::nav::Item::link_disabled(L10n::n("Disabled"), |_| "#".into()))
|
||||
/// .with_item(bs::nav::Item::link_disabled(Lc::n("Disabled"), "#"))
|
||||
/// ));
|
||||
/// ```
|
||||
///
|
||||
|
|
@ -80,15 +80,15 @@ const TOGGLE_OFFCANVAS: &str = "offcanvas";
|
|||
/// # use pagetop::prelude::*;
|
||||
/// # use pagetop_bootsier::theme::*;
|
||||
/// let brand = bs::navbar::Brand::new()
|
||||
/// .with_title(L10n::n("Intranet"))
|
||||
/// .with_route(Some(|cx| cx.route("/")));
|
||||
/// .with_title(Lc::n("Intranet"))
|
||||
/// .with_route(Some("/".into()));
|
||||
///
|
||||
/// let navbar = bs::Navbar::brand_right(brand)
|
||||
/// .with_expand(token::BreakPoint::LG)
|
||||
/// .with_expand(BreakPoint::LG)
|
||||
/// .with_item(bs::navbar::Item::nav(
|
||||
/// bs::Nav::pills()
|
||||
/// .with_item(bs::nav::Item::link(L10n::n("Dashboard"), |_| "/dashboard".into()))
|
||||
/// .with_item(bs::nav::Item::link(L10n::n("Users"), |_| "/users".into()))
|
||||
/// .with_item(bs::nav::Item::link(Lc::n("Dashboard"), "/dashboard"))
|
||||
/// .with_item(bs::nav::Item::link(Lc::n("Users"), "/users"))
|
||||
/// ));
|
||||
/// ```
|
||||
///
|
||||
|
|
@ -99,20 +99,20 @@ const TOGGLE_OFFCANVAS: &str = "offcanvas";
|
|||
/// # use pagetop_bootsier::theme::*;
|
||||
/// let oc = bs::Offcanvas::new()
|
||||
/// .with_id("main_offcanvas")
|
||||
/// .with_title(L10n::n("Main menu"))
|
||||
/// .with_title(Lc::n("Main menu"))
|
||||
/// .with_placement(bs::offcanvas::Placement::Start)
|
||||
/// .with_backdrop(bs::offcanvas::Backdrop::Enabled);
|
||||
///
|
||||
/// let navbar = bs::Navbar::offcanvas(oc)
|
||||
/// .with_item(bs::navbar::Item::nav(
|
||||
/// bs::Nav::new()
|
||||
/// .with_item(bs::nav::Item::link(L10n::n("Home"), |_| "/".into()))
|
||||
/// .with_item(bs::nav::Item::link(L10n::n("Profile"), |_| "/profile".into()))
|
||||
/// .with_item(bs::nav::Item::link(Lc::n("Home"), "/"))
|
||||
/// .with_item(bs::nav::Item::link(Lc::n("Profile"), "/profile"))
|
||||
/// .with_item(bs::nav::Item::dropdown(
|
||||
/// bs::Dropdown::new()
|
||||
/// .with_title(L10n::n("More"))
|
||||
/// .with_item(bs::dropdown::Item::link(L10n::n("Settings"), |_| "/settings".into()))
|
||||
/// .with_item(bs::dropdown::Item::link(L10n::n("Help"), |_| "/help".into()))
|
||||
/// .with_title(Lc::n("More"))
|
||||
/// .with_item(bs::dropdown::Item::link(Lc::n("Settings"), "/settings"))
|
||||
/// .with_item(bs::dropdown::Item::link(Lc::n("Help"), "/help"))
|
||||
/// ))
|
||||
/// ));
|
||||
/// ```
|
||||
|
|
@ -123,16 +123,16 @@ const TOGGLE_OFFCANVAS: &str = "offcanvas";
|
|||
/// # use pagetop::prelude::*;
|
||||
/// # use pagetop_bootsier::theme::*;
|
||||
/// let brand = bs::navbar::Brand::new()
|
||||
/// .with_title(L10n::n("Main App"))
|
||||
/// .with_route(Some(|cx| cx.route("/")));
|
||||
/// .with_title(Lc::n("Main App"))
|
||||
/// .with_route(Some("/".into()));
|
||||
///
|
||||
/// let navbar = bs::Navbar::brand_left(brand)
|
||||
/// .with_position(bs::navbar::Position::FixedTop)
|
||||
/// .with_item(bs::navbar::Item::nav(
|
||||
/// bs::Nav::new()
|
||||
/// .with_item(bs::nav::Item::link(L10n::n("Dashboard"), |_| "/".into()))
|
||||
/// .with_item(bs::nav::Item::link(L10n::n("Donors"), |_| "/donors".into()))
|
||||
/// .with_item(bs::nav::Item::link(L10n::n("Stock"), |_| "/stock".into()))
|
||||
/// .with_item(bs::nav::Item::link(Lc::n("Dashboard"), "/"))
|
||||
/// .with_item(bs::nav::Item::link(Lc::n("Donors"), "/donors"))
|
||||
/// .with_item(bs::nav::Item::link(Lc::n("Stock"), "/stock"))
|
||||
/// ));
|
||||
/// ```
|
||||
#[derive(AutoDefault, Clone, Debug, Getters)]
|
||||
|
|
@ -140,7 +140,7 @@ pub struct Navbar {
|
|||
/// Devuelve identificador, clases CSS, atributos HTML y valores extra del componente.
|
||||
props: Props,
|
||||
/// Devuelve el punto de ruptura configurado.
|
||||
expand: token::BreakPoint,
|
||||
expand: BreakPoint,
|
||||
/// Devuelve la disposición configurada para la barra de navegación.
|
||||
layout: bs::navbar::Layout,
|
||||
/// Devuelve la posición configurada para la barra de navegación.
|
||||
|
|
@ -189,7 +189,7 @@ impl Component for Navbar {
|
|||
data-bs-target=(id_content_target)
|
||||
aria-controls=(id_content)
|
||||
aria-expanded=[aria_expanded]
|
||||
aria-label=[L10n::t("toggle", &LOCALES_BOOTSIER).lookup(cx)]
|
||||
aria-label=[Lc::t("toggle", &LOCALES_BOOTSIER).lookup(cx)]
|
||||
{
|
||||
span class="navbar-toggler-icon" {}
|
||||
}
|
||||
|
|
@ -350,7 +350,7 @@ impl Navbar {
|
|||
///
|
||||
/// También acepta clases predefinidas para:
|
||||
///
|
||||
/// - Modificar el color de fondo ([`Background`]).
|
||||
/// - Modificar el color de fondo ([`Bg`]).
|
||||
/// - Definir la apariencia del texto ([`Text`]).
|
||||
#[builder_fn]
|
||||
pub fn with_prop(mut self, op: PropsOp) -> Self {
|
||||
|
|
@ -360,7 +360,7 @@ impl Navbar {
|
|||
|
||||
/// Define a partir de qué punto de ruptura la barra de navegación deja de colapsar.
|
||||
#[builder_fn]
|
||||
pub fn with_expand(mut self, bp: token::BreakPoint) -> Self {
|
||||
pub fn with_expand(mut self, bp: BreakPoint) -> Self {
|
||||
self.expand = bp;
|
||||
self
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ pub enum Item {
|
|||
/// Representa un menú de navegación [`Nav`](crate::theme::bs::Nav).
|
||||
Nav(Embed<bs::Nav>),
|
||||
/// Representa un *texto localizado* libre.
|
||||
Text(L10n),
|
||||
Text(Lc),
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
|
|
@ -92,7 +92,7 @@ impl Item {
|
|||
}
|
||||
|
||||
/// Crea un elemento con un *texto localizado*, mostrado sin interacción.
|
||||
pub fn text(item: L10n) -> Self {
|
||||
pub fn text(item: Lc) -> Self {
|
||||
Self::Text(item)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue