From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [yew-devel] [PATCH yew-widget-toolkit] reset_button: make default text translatable
Date: Tue, 9 Sep 2025 10:52:47 +0200 [thread overview]
Message-ID: <20250909085303.93201-1-m.sandoval@proxmox.com> (raw)
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
src/widget/form/reset_button.rs | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/widget/form/reset_button.rs b/src/widget/form/reset_button.rs
index e9d3ec28..8e583b0c 100644
--- a/src/widget/form/reset_button.rs
+++ b/src/widget/form/reset_button.rs
@@ -4,6 +4,7 @@ use yew::html::{IntoEventCallback, IntoPropValue};
use yew::prelude::*;
use crate::props::{EventSubscriber, WidgetBuilder};
+use crate::tr;
use crate::widget::Button;
use super::{FormContext, FormContextObserver};
@@ -20,9 +21,9 @@ use pwt_macros::{builder, widget};
#[builder]
pub struct ResetButton {
/// Button text (default "Reset").
- #[prop_or(AttrValue::Static("Reset"))]
+ #[prop_or_default]
#[builder(IntoPropValue, into_prop_value)]
- pub text: AttrValue,
+ pub text: Option<AttrValue>,
/// Reset button press callback.
#[prop_or_default]
@@ -127,7 +128,12 @@ impl Component for PwtResetButton {
}
});
- Button::new(&props.text)
+ let builder = if let Some(text) = &props.text {
+ Button::new(text)
+ } else {
+ Button::new(tr!("Reset"))
+ };
+ builder
.with_std_props(props.as_std_props())
.disabled(!form_dirty)
.onclick(reset)
--
2.47.3
_______________________________________________
yew-devel mailing list
yew-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel
next reply other threads:[~2025-09-09 8:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-09 8:52 Maximiliano Sandoval [this message]
2025-09-10 13:10 ` [yew-devel] applied: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250909085303.93201-1-m.sandoval@proxmox.com \
--to=m.sandoval@proxmox.com \
--cc=yew-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox