Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark the iSCSI texts for translation #722

Merged
merged 1 commit into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions web/src/components/storage/iscsi/AuthFields.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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")}
</p>
);
};

return (
<>
<Fieldset legend="Authentication by target">
<Fieldset legend={_("Authentication by target")}>
<FormGroup
fieldId="username"
label="Username"
helperTextInvalid="Incorrect username"
label={_("User name")}
helperTextInvalid={_("Incorrect user name")}
validated={showUsernameError() ? "error" : "default"}
>
<TextInput
id="username"
name="username"
aria-label="Username"
aria-label={_("User name")}
value={data.username || ""}
label="Username"
label={_("User name")}
onChange={onUsernameChange}
validated={showUsernameError() ? "error" : "default"}
/>
</FormGroup>
<FormGroup
fieldId="password"
label="Password"
helperTextInvalid="Incorrect password"
label={_("Password")}
helperTextInvalid={_("Incorrect password")}
validated={showPasswordError() ? "error" : "default"}
>
<TextInput
id="password"
name="password"
type="password"
aria-label="Password"
aria-label={_("Password")}
value={data.password || ""}
label="Password"
label={_("Password")}
onChange={onPasswordChange}
validated={showPasswordError() ? "error" : "default"}
/>
</FormGroup>
</Fieldset>
<Fieldset legend="Authentication by initiator">
<Fieldset legend={_("Authentication by initiator")}>
<ByInitiatorAuthTip />
<FormGroup
fieldId="reverseUsername"
label="Username"
helperTextInvalid="Incorrect username"
label={_("User name")}
helperTextInvalid={_("Incorrect user name")}
validated={showReverseUsernameError() ? "error" : "default"}
>
<TextInput
id="reverseUsername"
name="reverseUsername"
aria-label="Username"
aria-label={_("User name")}
value={data.reverseUsername || ""}
label="Username"
label={_("User name")}
isDisabled={!isValidAuth()}
onChange={onReverseUsernameChange}
validated={showReverseUsernameError() ? "error" : "default"}
Expand All @@ -130,16 +131,16 @@ export default function AuthFields({ data, onChange, onValidate }) {
<FormGroup
fieldId="reversePassword"
label="Password"
helperTextInvalid="Incorrect password"
helperTextInvalid={_("Incorrect password")}
validated={showReversePasswordError() ? "error" : "default"}
>
<TextInput
id="reversePassword"
name="reversePassword"
type="password"
aria-label="Target Password"
aria-label={_("Target Password")}
value={data.reversePassword || ""}
label="Password"
label={_("Password")}
isDisabled={!isValidAuth()}
onChange={onReversePasswordChange}
validated={showReversePasswordError() ? "error" : "default"}
Expand Down
26 changes: 15 additions & 11 deletions web/src/components/storage/iscsi/DiscoverForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { Popup } from "~/components/core";
import { AuthFields } from "~/components/storage/iscsi";
import { useLocalStorage } from "~/utils";
import { isValidIp } from "~/client/network/utils";
import { _ } from "~/i18n";

const defaultData = {
address: "",
Expand Down Expand Up @@ -96,49 +97,52 @@ export default function DiscoverForm({ onSubmit: onSubmitProp, onCancel }) {
const isDisabled = isLoading || !isValidForm();

return (
<Popup isOpen title="Discover iSCSI Targets">
// TRANSLATORS: popup title
<Popup isOpen title={_("Discover iSCSI Targets")}>
<Form id={id} onSubmit={onSubmit}>
{ isFailed &&
<div ref={alertRef}>
<Alert
variant="warning"
isInline
title="Something went wrong"
title={_("Something went wrong")}
>
<p>Make sure you provide the correct values</p>
<p>{_("Make sure you provide the correct values")}</p>
</Alert>
</div> }
<FormGroup
fieldId="address"
label="IP address"
label={_("IP address")}
isRequired
helperTextInvalid="Incorrect IP address"
helperTextInvalid={_("Incorrect IP address")}
validated={showAddressError() ? "error" : "default"}
>
<TextInput
id="address"
name="address"
aria-label="Address"
// TRANSLATORS: network address
aria-label={_("Address")}
value={data.address || ""}
label="Address"
label={_("Address")}
isRequired
onChange={onAddressChange}
validated={showAddressError() ? "error" : "default"}
/>
</FormGroup>
<FormGroup
fieldId="port"
label="Port"
label={_("Port")}
isRequired
helperTextInvalid="Incorrect port"
helperTextInvalid={_("Incorrect port")}
validated={showPortError() ? "error" : "default"}
>
<TextInput
id="port"
name="port"
aria-label="Port"
// TRANSLATORS: network port number
aria-label={_("Port")}
value={data.port || ""}
label="Port"
label={_("Port")}
isRequired
onChange={onPortChange}
validated={showPortError() ? "error" : "default"}
Expand Down
5 changes: 4 additions & 1 deletion web/src/components/storage/iscsi/EditNodeForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ import React, { useState } from "react";
import {
Form, FormGroup, FormSelect, FormSelectOption
} from "@patternfly/react-core";
import format from "format-util";

import { _ } from "~/i18n";
import { Popup } from "~/components/core";
import { NodeStartupOptions } from "~/components/storage/iscsi";

Expand All @@ -44,7 +46,8 @@ export default function EditNodeForm({ node, onSubmit: onSubmitProp, onCancel })
const id = "iscsiEditNode";

return (
<Popup isOpen title={`Edit ${node.target}`}>
// TRANSLATORS: %s is replaced by the iSCSI target node name
<Popup isOpen title={format(_("Edit %s"), node.target)}>
<Form id={id} onSubmit={onSubmit}>
<FormGroup fieldId="startup" label="Startup">
<FormSelect
Expand Down
9 changes: 6 additions & 3 deletions web/src/components/storage/iscsi/InitiatorForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import React, { useState } from "react";
import { Form, FormGroup, TextInput } from "@patternfly/react-core";

import { _ } from "~/i18n";
import { Popup } from "~/components/core";

export default function InitiatorForm({ initiator, onSubmit: onSubmitProp, onCancel }) {
Expand All @@ -38,15 +39,17 @@ export default function InitiatorForm({ initiator, onSubmit: onSubmitProp, onCan
const isDisabled = data.name === "";

return (
<Popup isOpen title="Edit iSCSI Initiator">
<Popup isOpen title={_("Edit iSCSI Initiator")}>
<Form id={id} onSubmit={onSubmit}>
<FormGroup fieldId="initiatorName" label="Name" isRequired>
<TextInput
id="initiatorName"
name="name"
aria-label="Initiator name"
// TRANSLATORS: iSCSI initiator name
aria-label={_("Initiator name")}
value={data.name || ""}
label="Name"
// TRANSLATORS: input field for the iSCSI initiator name
label={_("Name")}
isRequired
onChange={onNameChange}
/>
Expand Down
17 changes: 10 additions & 7 deletions web/src/components/storage/iscsi/InitiatorPresenter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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];
Expand All @@ -64,9 +65,11 @@ export default function InitiatorPresenter({ initiator, client }) {

return (
<Tr>
<Td dataLabel="Name">{initiator.name}</Td>
<Td dataLabel="iBFT">{initiator.ibft ? "Yes" : "No"}</Td>
<Td dataLabel="Offload card">{initiator.offloadCard || "None"}</Td>
<Td dataLabel={_("Name")}>{initiator.name}</Td>
{/* TRANSLATORS: usually just keep the original text */}
{/* iBFT = iSCSI Boot Firmware Table, HW support for booting from iSCSI */}
<Td dataLabel={_("iBFT")}>{initiator.ibft ? _("Yes") : _("No")}</Td>
<Td dataLabel={_("Offload card")}>{initiator.offloadCard || _("None")}</Td>
<Td isActionCell>
<RowActions actions={initiatorActions()} id="actions-for-initiator" />
</Td>
Expand All @@ -79,9 +82,9 @@ export default function InitiatorPresenter({ initiator, client }) {
<TableComposable variant="compact">
<Thead>
<Tr>
<Th width={50}>Name</Th>
<Th>iBFT</Th>
<Th>Offload card</Th>
<Th width={50}>{_("Name")}</Th>
<Th>{_("iBFT")}</Th>
<Th>{_("Offload card")}</Th>
<Th />
</Tr>
</Thead>
Expand Down
4 changes: 3 additions & 1 deletion web/src/components/storage/iscsi/InitiatorSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -45,7 +46,8 @@ export default function InitiatorSection() {
}, [cancellablePromise, client.iscsi]);

return (
<Section title="Initiator">
// TRANSLATORS: iSCSI initiator section name
<Section title={_("Initiator")}>
<InitiatorPresenter
initiator={initiator}
client={client}
Expand Down
14 changes: 9 additions & 5 deletions web/src/components/storage/iscsi/LoginForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import {
Alert,
Form, FormGroup, FormSelect, FormSelectOption
} from "@patternfly/react-core";
import format from "format-util";

import { _ } from "~/i18n";
import { Popup } from "~/components/core";
import { AuthFields, NodeStartupOptions } from "~/components/storage/iscsi";

Expand Down Expand Up @@ -63,16 +65,18 @@ export default function LoginForm({ node, onSubmit: onSubmitProp, onCancel }) {
const isDisabled = isLoading || !isValidAuth;

return (
<Popup isOpen title={`Login ${node.target}`}>
// TRANSLATORS: %s is replaced by the iSCSI target name
<Popup isOpen title={format("Login %s", node.target)}>
<Form id={id} onSubmit={onSubmit}>
{ isFailed &&
<Alert variant="warning" isInline title="Something went wrong">
<p>Make sure you provide the correct values</p>
<Alert variant="warning" isInline title={_("Something went wrong")}>
<p>{_("Make sure you provide the correct values")}</p>
</Alert> }
<FormGroup fieldId="startup" label="Startup">
{/* TRANSLATORS: iSCSI start up mode (on boot/manual/automatic) */}
<FormGroup fieldId="startup" label={_("Startup")}>
<FormSelect
id="startup"
aria-label="startup"
aria-label={_("Startup")}
value={data.startup}
onChange={onStartupChange}
>
Expand Down
8 changes: 5 additions & 3 deletions web/src/components/storage/iscsi/NodeStartupOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Loading
Loading