♻️ (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
|
|
@ -1,4 +1,4 @@
|
|||
use crate::locale::{L10n, LangId};
|
||||
use crate::locale::{LangId, Lc};
|
||||
use crate::{AutoDefault, builder_fn, util};
|
||||
|
||||
/// Valor opcional para atributos HTML.
|
||||
|
|
@ -7,7 +7,7 @@ use crate::{AutoDefault, builder_fn, util};
|
|||
/// opcionales, uniformes y tipados.
|
||||
///
|
||||
/// Este tipo **no impone ninguna normalización ni semántica concreta**; dichas reglas se definen en
|
||||
/// implementaciones concretas como `Attr<L10n>` y `Attr<String>`, o en tipos específicos como
|
||||
/// implementaciones concretas como `Attr<Lc>` y `Attr<String>`, o en tipos específicos como
|
||||
/// [`AttrName`].
|
||||
#[derive(AutoDefault, Clone, Debug)]
|
||||
pub struct Attr<T>(Option<T>);
|
||||
|
|
@ -72,18 +72,18 @@ impl<T> Attr<T> {
|
|||
}
|
||||
}
|
||||
|
||||
// **< Attr<L10n> >*********************************************************************************
|
||||
// **< Attr<Lc> >***********************************************************************************
|
||||
|
||||
/// Extiende [`Attr`] para [texto localizado](crate::locale) en atributos HTML.
|
||||
///
|
||||
/// Encapsula un [`L10n`] para manejar traducciones de forma segura en atributos.
|
||||
/// Encapsula un [`Lc`] para manejar traducciones de forma segura en atributos.
|
||||
///
|
||||
/// # Ejemplo
|
||||
///
|
||||
/// ```rust
|
||||
/// # use pagetop::prelude::*;
|
||||
/// // Traducción por clave en las locales por defecto de PageTop.
|
||||
/// let hello = Attr::<L10n>::new(L10n::l("test_hello_world"));
|
||||
/// let hello = Attr::<Lc>::new(Lc::l("test_hello_world"));
|
||||
///
|
||||
/// // Español disponible.
|
||||
/// assert_eq!(
|
||||
|
|
@ -101,9 +101,9 @@ impl<T> Attr<T> {
|
|||
/// let title = hello.value(&Locale::resolve("es-ES"));
|
||||
/// // Ejemplo: html! { a title=(title) { "Link" } }
|
||||
/// ```
|
||||
impl Attr<L10n> {
|
||||
/// Crea una nueva instancia `Attr<L10n>`.
|
||||
pub fn new(value: L10n) -> Self {
|
||||
impl Attr<Lc> {
|
||||
/// Crea una nueva instancia `Attr<Lc>`.
|
||||
pub fn new(value: Lc) -> Self {
|
||||
Self::some(value)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::AutoDefault;
|
||||
use crate::core::component::Context;
|
||||
use crate::html::{Markup, html};
|
||||
use crate::locale::L10n;
|
||||
use crate::locale::Lc;
|
||||
|
||||
/// Representación SVG del **logotipo de PageTop** para incrustar en HTML.
|
||||
///
|
||||
|
|
@ -54,7 +54,7 @@ impl PageTopSvg {
|
|||
viewBox="0 0 1614 1614"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
role="img"
|
||||
aria-label=[L10n::l("pagetop_logo").lookup(cx)]
|
||||
aria-label=[Lc::l("pagetop_logo").lookup(cx)]
|
||||
preserveAspectRatio="xMidYMid slice"
|
||||
focusable="false"
|
||||
{
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ impl PropsOp {
|
|||
/// # use pagetop::prelude::*;
|
||||
/// #[derive(AutoDefault, Clone, Getters)]
|
||||
/// pub struct MyButton {
|
||||
/// label: L10n,
|
||||
/// label: Lc,
|
||||
/// props: Props,
|
||||
/// }
|
||||
///
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue