🧑‍💻 Mejora y simplifica localización de módulos

This commit is contained in:
Manuel Cillero 2023-06-04 00:43:28 +02:00
parent d0add7c7ab
commit 520d3bb20b
21 changed files with 265 additions and 325 deletions

View file

@ -23,7 +23,7 @@ pub enum AnchorTarget {
}
type AnchorIcon = OneComponent<Icon>;
type AnchorHtml = OneComponent<Text>;
type AnchorHtml = OneComponent<L10n>;
#[rustfmt::skip]
#[derive(Default)]
@ -91,11 +91,11 @@ impl ComponentTrait for Anchor {
}
impl Anchor {
pub fn link(href: &str, html: Text) -> Self {
pub fn link(href: &str, html: L10n) -> Self {
Anchor::new().with_href(href).with_html(html)
}
pub fn button(href: &str, html: Text) -> Self {
pub fn button(href: &str, html: L10n) -> Self {
Anchor::new()
.with_type(AnchorType::Button)
.with_href(href)
@ -152,7 +152,7 @@ impl Anchor {
}
#[fn_builder]
pub fn alter_html(&mut self, html: Text) -> &mut Self {
pub fn alter_html(&mut self, html: L10n) -> &mut Self {
self.html.set(html);
self
}

View file

@ -10,7 +10,7 @@ pub enum ButtonType {
Reset,
}
type ButtonValue = OneComponent<Text>;
type ButtonValue = OneComponent<L10n>;
#[rustfmt::skip]
#[derive(Default)]
@ -77,11 +77,11 @@ impl ComponentTrait for Button {
}
impl Button {
pub fn with(value: Text) -> Self {
pub fn with(value: L10n) -> Self {
Button::new().with_value(value)
}
pub fn submit(value: Text) -> Self {
pub fn submit(value: L10n) -> Self {
let mut button = Button::new()
.with_classes(ClassesOp::Replace("form-button"), "form-submit")
.with_value(value);
@ -89,7 +89,7 @@ impl Button {
button
}
pub fn reset(value: Text) -> Self {
pub fn reset(value: L10n) -> Self {
let mut button = Button::new()
.with_classes(ClassesOp::Replace("form-button"), "form-reset")
.with_value(value);
@ -124,7 +124,7 @@ impl Button {
}
#[fn_builder]
pub fn alter_value(&mut self, value: Text) -> &mut Self {
pub fn alter_value(&mut self, value: L10n) -> &mut Self {
self.value.set(value);
self
}

View file

@ -13,8 +13,8 @@ pub enum InputType {
Url,
}
type InputLabel = OneComponent<Text>;
type InputHelpText = OneComponent<Text>;
type InputLabel = OneComponent<L10n>;
type InputHelpText = OneComponent<L10n>;
#[rustfmt::skip]
#[derive(Default)]
@ -206,7 +206,7 @@ impl Input {
}
#[fn_builder]
pub fn alter_label(&mut self, label: Text) -> &mut Self {
pub fn alter_label(&mut self, label: L10n) -> &mut Self {
self.label.set(label);
self
}
@ -281,7 +281,7 @@ impl Input {
}
#[fn_builder]
pub fn alter_help_text(&mut self, help_text: Text) -> &mut Self {
pub fn alter_help_text(&mut self, help_text: L10n) -> &mut Self {
self.help_text.set(help_text);
self
}

View file

@ -25,7 +25,7 @@ pub enum HeadingDisplay {
Subtitle,
}
type HeadingText = OneComponent<Text>;
type HeadingText = OneComponent<L10n>;
#[rustfmt::skip]
#[derive(Default)]
@ -80,37 +80,37 @@ impl ComponentTrait for Heading {
}
impl Heading {
pub fn h1(text: Text) -> Self {
pub fn h1(text: L10n) -> Self {
Heading::new()
.with_heading_type(HeadingType::H1)
.with_text(text)
}
pub fn h2(text: Text) -> Self {
pub fn h2(text: L10n) -> Self {
Heading::new()
.with_heading_type(HeadingType::H2)
.with_text(text)
}
pub fn h3(text: Text) -> Self {
pub fn h3(text: L10n) -> Self {
Heading::new()
.with_heading_type(HeadingType::H3)
.with_text(text)
}
pub fn h4(text: Text) -> Self {
pub fn h4(text: L10n) -> Self {
Heading::new()
.with_heading_type(HeadingType::H4)
.with_text(text)
}
pub fn h5(text: Text) -> Self {
pub fn h5(text: L10n) -> Self {
Heading::new()
.with_heading_type(HeadingType::H5)
.with_text(text)
}
pub fn h6(text: Text) -> Self {
pub fn h6(text: L10n) -> Self {
Heading::new()
.with_heading_type(HeadingType::H6)
.with_text(text)
@ -149,7 +149,7 @@ impl Heading {
}
#[fn_builder]
pub fn alter_text(&mut self, text: Text) -> &mut Self {
pub fn alter_text(&mut self, text: L10n) -> &mut Self {
self.text.set(text);
self
}