all lists on 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
  0 siblings, 0 replies; only message 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] only message in thread

only message in thread, other threads:[~2025-09-09  8:53 UTC | newest]

Thread overview: (only message) (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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal