From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id C5A421FF16B for ; Tue, 9 Sep 2025 10:53:03 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 415013539; Tue, 9 Sep 2025 10:53:07 +0200 (CEST) From: Maximiliano Sandoval To: yew-devel@lists.proxmox.com Date: Tue, 9 Sep 2025 10:52:47 +0200 Message-ID: <20250909085303.93201-1-m.sandoval@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1757407960393 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.101 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [yew-devel] [PATCH yew-widget-toolkit] reset_button: make default text translatable X-BeenThere: yew-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Yew framework devel list at Proxmox List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Yew framework devel list at Proxmox Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: yew-devel-bounces@lists.proxmox.com Sender: "yew-devel" Signed-off-by: Maximiliano Sandoval --- 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, /// 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