[yew-devel] [PATCH proxmox-yew-comp 1/2] mark missing strings as translatable
Maximiliano Sandoval
m.sandoval at proxmox.com
Tue Feb 18 14:35:02 CET 2025
Maximiliano Sandoval <m.sandoval at proxmox.com> writes:
> Maximiliano Sandoval <m.sandoval at proxmox.com> writes:
>
>> Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
>> ---
>> src/realm_selector.rs | 5 +++--
>> src/task_viewer.rs | 7 +++++--
>> src/tfa/tfa_dialog.rs | 21 +++++++++++++--------
>> src/tfa/tfa_view.rs | 2 +-
>> 4 files changed, 22 insertions(+), 13 deletions(-)
>>
>> diff --git a/src/realm_selector.rs b/src/realm_selector.rs
>> index 6522c59..0734574 100644
>> --- a/src/realm_selector.rs
>> +++ b/src/realm_selector.rs
>> @@ -6,6 +6,7 @@ use yew::prelude::*;
>>
>> use pwt::props::RenderFn;
>> use pwt::state::Store;
>> +use pwt::tr;
>> use pwt::widget::data_table::{DataTable, DataTableColumn, DataTableHeader};
>> use pwt::widget::form::{Selector, SelectorRenderArgs, ValidateFn};
>> use pwt::widget::GridPicker;
>> @@ -14,14 +15,14 @@ use crate::common_api_types::BasicRealmInfo;
>>
>> thread_local! {
>> static COLUMNS: Rc<Vec<DataTableHeader<BasicRealmInfo>>> = Rc::new(vec![
>> - DataTableColumn::new("Realm")
>> + DataTableColumn::new(tr!("Realm"))
>> .width("100px")
>> .show_menu(false)
>> .render(|record: &BasicRealmInfo| {
>> html!{record.realm.clone()}
>> })
>> .into(),
>> - DataTableColumn::new("Comment")
>> + DataTableColumn::new(tr!("Comment"))
>> .width("300px")
>> .show_menu(false)
>> .render(|record: &BasicRealmInfo| {
>> diff --git a/src/task_viewer.rs b/src/task_viewer.rs
>> index 85958e8..0fbfeac 100644
>> --- a/src/task_viewer.rs
>> +++ b/src/task_viewer.rs
>> @@ -159,9 +159,12 @@ impl Component for PwtTaskViewer {
>> let panel = self.loader.render(|data| {
>> TabPanel::new()
>> .class("pwt-flex-fit")
>> - .with_item(TabBarItem::new().label("Output"), self.view_output(ctx))
>> .with_item(
>> - TabBarItem::new().label("Status"),
>> + TabBarItem::new().label(tr!("Output")),
>> + self.view_output(ctx),
>> + )
>> + .with_item(
>> + TabBarItem::new().label(tr!("Status")),
>> self.view_status(ctx, data.clone()),
>> )
>> });
>> diff --git a/src/tfa/tfa_dialog.rs b/src/tfa/tfa_dialog.rs
>> index ec84ff8..c23c568 100644
>> --- a/src/tfa/tfa_dialog.rs
>> +++ b/src/tfa/tfa_dialog.rs
>> @@ -183,25 +183,30 @@ impl Component for ProxmoxTfaDialog {
>> let mut panel = TabPanel::new().class("pwt-flex-fill");
>>
>> if props.challenge.challenge.totp {
>> - panel.add_item_builder(TabBarItem::new().key("totp").label("TOTP App"), {
>> + // TRANSLATORS: TOTP means time-based one-time password
>> + panel.add_item_builder(TabBarItem::new().key("totp").label(tr!("TOTP App")), {
>> let on_totp = props.on_totp.clone();
>> move |_| render_totp(on_totp.clone())
>> });
>> }
>>
>> if props.challenge.challenge.yubico {
>> - panel.add_item_builder(TabBarItem::new().key("yubico").label("Yubico OTP"), {
>> + // TRANSLATORS: Yubico is a company name. OTP means one-time password
>> + panel.add_item_builder(TabBarItem::new().key("yubico").label(tr!("Yubico OTP")), {
>> let on_yubico = props.on_yubico.clone();
>> move |_| render_yubico(on_yubico.clone())
>> });
>> }
>>
>> if props.challenge.challenge.recovery.is_available() {
>> - panel.add_item_builder(TabBarItem::new().key("recovery").label("Recovery Key"), {
>> - let on_recovery = props.on_recovery.clone();
>> - let available_keys = props.challenge.challenge.recovery.0.clone();
>> - move |_| render_recovery(on_recovery.clone(), &available_keys)
>> - });
>> + panel.add_item_builder(
>> + TabBarItem::new().key("recovery").label(tr!("Recovery Key")),
>> + {
>> + let on_recovery = props.on_recovery.clone();
>> + let available_keys = props.challenge.challenge.recovery.0.clone();
>> + move |_| render_recovery(on_recovery.clone(), &available_keys)
>> + },
>> + );
>> }
>>
>> /*
>> @@ -219,7 +224,7 @@ impl Component for ProxmoxTfaDialog {
>> }
>> */
>> if let Some((challenge, challenge_string)) = self.webauthn_challenge.clone() {
>> - panel.add_item_builder(TabBarItem::new().key("webauthn").label("WebAuthN"), {
>> + panel.add_item_builder(TabBarItem::new().key("webauthn").label(tr!("WebAuthn")), {
>> let on_webauthn = props.on_webauthn.clone();
>> move |info: &SelectionViewRenderInfo| {
>> WebAuthn::new()
>> diff --git a/src/tfa/tfa_view.rs b/src/tfa/tfa_view.rs
>> index 45f7a66..c4c1a43 100644
>> --- a/src/tfa/tfa_view.rs
>> +++ b/src/tfa/tfa_view.rs
>> @@ -268,7 +268,7 @@ impl LoadableComponent for ProxmoxTfaView {
>> .class("pwt-w-100")
>> .class("pwt-overflow-hidden")
>> .class("pwt-border-bottom")
>> - .with_child(MenuButton::new("Add").show_arrow(true).menu(add_menu))
>> + .with_child(MenuButton::new(tr!("Add")).show_arrow(true).menu(add_menu))
>> .with_spacer()
>> .with_child(
>> Button::new(tr!("Edit"))
>
> ping.
ping.
More information about the yew-devel
mailing list