public inbox for yew-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [yew-devel] [PATCH yew-widget-toolkit] reset_button: make default text translatable
@ 2025-09-09  8:52 Maximiliano Sandoval
  2025-09-10 13:10 ` [yew-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Maximiliano Sandoval @ 2025-09-09  8:52 UTC (permalink / raw)
  To: yew-devel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [yew-devel] applied: [PATCH yew-widget-toolkit] reset_button: make default text translatable
  2025-09-09  8:52 [yew-devel] [PATCH yew-widget-toolkit] reset_button: make default text translatable Maximiliano Sandoval
@ 2025-09-10 13:10 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-09-10 13:10 UTC (permalink / raw)
  To: yew-devel, Maximiliano Sandoval

On Tue, 09 Sep 2025 10:52:47 +0200, Maximiliano Sandoval wrote:
> 


Applied, thanks!

[1/1] reset_button: make default text translatable
      commit: f8224598346a1e5ad6dd3dd827d1e18ff91617fa


_______________________________________________
yew-devel mailing list
yew-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-09-10 13:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-09  8:52 [yew-devel] [PATCH yew-widget-toolkit] reset_button: make default text translatable Maximiliano Sandoval
2025-09-10 13:10 ` [yew-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal