From 832c896b74ee9ae49d385cb22e1266cd20f9ed2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Mon, 28 Aug 2023 18:31:56 +0200 Subject: [PATCH] Mark the iSCSI texts for translation --- .../components/storage/iscsi/AuthFields.jsx | 37 ++++++++++--------- .../components/storage/iscsi/DiscoverForm.jsx | 26 +++++++------ .../components/storage/iscsi/EditNodeForm.jsx | 5 ++- .../storage/iscsi/InitiatorForm.jsx | 9 +++-- .../storage/iscsi/InitiatorPresenter.jsx | 17 +++++---- .../storage/iscsi/InitiatorSection.jsx | 4 +- .../components/storage/iscsi/LoginForm.jsx | 14 ++++--- .../storage/iscsi/NodeStartupOptions.js | 8 ++-- .../storage/iscsi/NodesPresenter.jsx | 36 ++++++++++-------- .../storage/iscsi/TargetsSection.jsx | 14 ++++--- 10 files changed, 100 insertions(+), 70 deletions(-) diff --git a/web/src/components/storage/iscsi/AuthFields.jsx b/web/src/components/storage/iscsi/AuthFields.jsx index 6b43c84127..09cebbbcd8 100644 --- a/web/src/components/storage/iscsi/AuthFields.jsx +++ b/web/src/components/storage/iscsi/AuthFields.jsx @@ -24,6 +24,7 @@ import { FormGroup, TextInput } from "@patternfly/react-core"; import { Fieldset } from "~/components/core"; import { Icon } from "~/components/layout"; +import { _ } from "~/i18n"; export default function AuthFields({ data, onChange, onValidate }) { const onUsernameChange = v => onChange("username", v); @@ -66,62 +67,62 @@ export default function AuthFields({ data, onChange, onValidate }) { size="16" style={{ verticalAlign: "text-bottom", marginRight: "0.3em" }} /> - Only available if authentication by target is provided + {_("Only available if authentication by target is provided")}

); }; return ( <> -
+
-
+
+ // TRANSLATORS: popup title +
{ isFailed &&
-

Make sure you provide the correct values

+

{_("Make sure you provide the correct values")}

} + // TRANSLATORS: %s is replaced by the iSCSI target node name + + diff --git a/web/src/components/storage/iscsi/InitiatorPresenter.jsx b/web/src/components/storage/iscsi/InitiatorPresenter.jsx index 9e9eab7ddb..a68a8b1767 100644 --- a/web/src/components/storage/iscsi/InitiatorPresenter.jsx +++ b/web/src/components/storage/iscsi/InitiatorPresenter.jsx @@ -23,6 +23,7 @@ import React, { useEffect, useState } from "react"; import { Skeleton } from "@patternfly/react-core"; import { TableComposable, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table'; +import { _ } from "~/i18n"; import { RowActions } from '~/components/core'; import { InitiatorForm } from "~/components/storage/iscsi"; @@ -45,7 +46,7 @@ export default function InitiatorPresenter({ initiator, client }) { const initiatorActions = () => { const actions = { - edit: { title: "Edit", onClick: openForm } + edit: { title: _("Edit"), onClick: openForm } }; return [actions.edit]; @@ -64,9 +65,11 @@ export default function InitiatorPresenter({ initiator, client }) { return ( - {initiator.name} - {initiator.ibft ? "Yes" : "No"} - {initiator.offloadCard || "None"} + {initiator.name} + {/* TRANSLATORS: usually just keep the original text */} + {/* iBFT = iSCSI Boot Firmware Table, HW support for booting from iSCSI */} + {initiator.ibft ? _("Yes") : _("No")} + {initiator.offloadCard || _("None")} @@ -79,9 +82,9 @@ export default function InitiatorPresenter({ initiator, client }) { - Name - iBFT - Offload card + {_("Name")} + {_("iBFT")} + {_("Offload card")} diff --git a/web/src/components/storage/iscsi/InitiatorSection.jsx b/web/src/components/storage/iscsi/InitiatorSection.jsx index 9d2eaca018..e7728eaf11 100644 --- a/web/src/components/storage/iscsi/InitiatorSection.jsx +++ b/web/src/components/storage/iscsi/InitiatorSection.jsx @@ -21,6 +21,7 @@ import React, { useEffect, useState } from "react"; +import { _ } from "~/i18n"; import { Section } from "~/components/core"; import { InitiatorPresenter } from "~/components/storage/iscsi"; import { useInstallerClient } from "~/context/installer"; @@ -45,7 +46,8 @@ export default function InitiatorSection() { }, [cancellablePromise, client.iscsi]); return ( -
+ // TRANSLATORS: iSCSI initiator section name +
+ // TRANSLATORS: %s is replaced by the iSCSI target name + { isFailed && - -

Make sure you provide the correct values

+ +

{_("Make sure you provide the correct values")}

} - + {/* TRANSLATORS: iSCSI start up mode (on boot/manual/automatic) */} + diff --git a/web/src/components/storage/iscsi/NodeStartupOptions.js b/web/src/components/storage/iscsi/NodeStartupOptions.js index fdfec899ac..1b9486f15a 100644 --- a/web/src/components/storage/iscsi/NodeStartupOptions.js +++ b/web/src/components/storage/iscsi/NodeStartupOptions.js @@ -19,10 +19,12 @@ * find current contact information at www.suse.com. */ +import { _ } from "~/i18n"; + const NodeStartupOptions = Object.freeze({ - MANUAL: { label: "Manual", value: "manual" }, - ONBOOT: { label: "On boot", value: "onboot" }, - AUTOMATIC: { label: "Automatic", value: "automatic" } + MANUAL: { label: _("Manual"), value: "manual" }, + ONBOOT: { label: _("On boot"), value: "onboot" }, + AUTOMATIC: { label: _("Automatic"), value: "automatic" } }); export default NodeStartupOptions; diff --git a/web/src/components/storage/iscsi/NodesPresenter.jsx b/web/src/components/storage/iscsi/NodesPresenter.jsx index e3f2b6a40d..b091aa64f6 100644 --- a/web/src/components/storage/iscsi/NodesPresenter.jsx +++ b/web/src/components/storage/iscsi/NodesPresenter.jsx @@ -21,7 +21,9 @@ import React, { useState } from "react"; import { TableComposable, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table'; +import format from "format-util"; +import { _ } from "~/i18n"; import { RowActions } from '~/components/core'; import { EditNodeForm, LoginForm, NodeStartupOptions } from "~/components/storage/iscsi"; @@ -57,29 +59,31 @@ export default function NodesPresenter ({ nodes, client }) { }; const nodeStatus = (node) => { - if (!node.connected) return "Disconnected"; + // TRANSLATORS: iSCSI connection status + if (!node.connected) return _("Disconnected"); const startup = Object.values(NodeStartupOptions).find(o => o.value === node.startup); - return `Connected (${startup.label})`; + // TRANSLATORS: iSCSI connection status, %s is replaced by node label + return format(_("Connected (%s)"), startup.label); }; const nodeActions = (node) => { const actions = { edit: { - title: "Edit", + title: _("Edit"), onClick: () => openEditForm(node) }, delete: { - title: "Delete", + title: _("Delete"), onClick: () => client.iscsi.delete(node), className: "danger-action" }, login: { - title: "Login", + title: _("Login"), onClick: () => openLoginForm(node) }, logout: { - title: "Logout", + title: _("Logout"), onClick: () => client.iscsi.logout(node) } }; @@ -93,11 +97,11 @@ export default function NodesPresenter ({ nodes, client }) { const NodeRow = ({ node }) => { return ( - {node.target} - {node.address + ":" + node.port} - {node.interface} - {node.ibft ? "Yes" : "No"} - {nodeStatus(node)} + {node.target} + {node.address + ":" + node.port} + {node.interface} + {node.ibft ? _("Yes") : _("No")} + {nodeStatus(node)} @@ -114,11 +118,11 @@ export default function NodesPresenter ({ nodes, client }) { - Name - Portal - Interface - iBFT - Status + {_("Name")} + {_("Portal")} + {_("Interface")} + {_("iBFT")} + {_("Status")} diff --git a/web/src/components/storage/iscsi/TargetsSection.jsx b/web/src/components/storage/iscsi/TargetsSection.jsx index a61e5a2a52..4462a8edef 100644 --- a/web/src/components/storage/iscsi/TargetsSection.jsx +++ b/web/src/components/storage/iscsi/TargetsSection.jsx @@ -25,6 +25,7 @@ import { Toolbar, ToolbarItem, ToolbarContent, } from "@patternfly/react-core"; +import { _ } from "~/i18n"; import { Section, SectionSkeleton } from "~/components/core"; import { NodesPresenter, DiscoverForm } from "~/components/storage/iscsi"; import { useInstallerClient } from "~/context/installer"; @@ -135,9 +136,10 @@ export default function TargetsSection() { if (state.nodes.length === 0) { return (
-
No iSCSI targets found
-
Please, perform an iSCSI discovery in order to find available iSCSI targets.
- +
{_("No iSCSI targets found")}
+
{_("Please, perform an iSCSI discovery in order to find available iSCSI targets.")}
+ {/* TRANSLATORS: button label, starts iSCSI discovery */} +
); } @@ -147,7 +149,8 @@ export default function TargetsSection() { - + {/* TRANSLATORS: button label, starts iSCSI discovery */} + @@ -160,7 +163,8 @@ export default function TargetsSection() { }; return ( -
+ // TRANSLATORS: iSCSI targets section title +
{ state.isDiscoverFormOpen &&