From 14393cd46a3c4ddff2fe843434ef5d15950f719b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 11 Aug 2023 19:56:58 +0200 Subject: [PATCH] Translate more texts --- web/src/components/core/InstallButton.jsx | 25 +++++++------------ web/src/components/overview/L10nSection.jsx | 9 +++++-- .../components/overview/NetworkSection.jsx | 17 ++++++++++--- .../components/overview/SoftwareSection.jsx | 14 ++++++++--- .../components/overview/StorageSection.jsx | 13 +++++++--- web/src/components/overview/UsersSection.jsx | 18 +++++++------ 6 files changed, 60 insertions(+), 36 deletions(-) diff --git a/web/src/components/core/InstallButton.jsx b/web/src/components/core/InstallButton.jsx index b996a884b6..9735bb21ca 100644 --- a/web/src/components/core/InstallButton.jsx +++ b/web/src/components/core/InstallButton.jsx @@ -40,24 +40,17 @@ const InstallConfirmationPopup = ({ hasIssues, onAccept, onClose }) => { ); }; + // TRANSLATORS: the installer reports some errors, + // the part in curly brackets {} is a clickable link + const [msgStart, msgLink, msgEnd] = _("There are some reported issues. \ +Please, check {the list of issues} \ +before proceeding with the installation.").split(/[{}]/); + return (

- { - // TRANSLATORS: the installer reports some errors, - // the beginning (1/3) - _("There are some reported issues. Please, check") - } - - { - // TRANSLATORS: the installer reports some errors, - // the end (3/3) - _("before proceeding with the installation.") - } + {msgStart} + + {msgEnd}

); }; diff --git a/web/src/components/overview/L10nSection.jsx b/web/src/components/overview/L10nSection.jsx index e72a771304..ce8c47c111 100644 --- a/web/src/components/overview/L10nSection.jsx +++ b/web/src/components/overview/L10nSection.jsx @@ -24,6 +24,7 @@ import { Text } from "@patternfly/react-core"; import { Em, Section, SectionSkeleton } from "~/components/core"; import { useCancellablePromise } from "~/utils"; import { useInstallerClient } from "~/context/installer"; +import { _ } from "~/i18n"; const initialState = { busy: true, @@ -64,9 +65,12 @@ export default function L10nSection({ showErrors }) { const selected = languages.find(lang => lang.id === language); + // TRANSLATORS: %s will be replaced by a language name and code, + // example: "English (en_US.UTF-8)" + const [msg1, msg2] = _("The system will use %s as its default language.").split("%s"); return ( - The system will use {`${selected.name} (${selected.id})`} as its default language. + {msg1}{`${selected.name} (${selected.id})`}{msg2} ); }; @@ -74,7 +78,8 @@ export default function L10nSection({ showErrors }) { return (
[ConnectionTypes.WIFI, ConnectionTypes.ETHERNET].includes(c.type)); - if (activeConnections.length === 0) return "No network connections detected"; + if (activeConnections.length === 0) return _("No network connections detected"); const summary = activeConnections.map(connection => ( {connection.name} - {connection.addresses.map(formatIp)} )); + const msg = format( + // TRANSLATORS: header for the list of active network connections, + // %d is replaced by the number of active connections + n_("%d connection set:", "%d connections set:", activeConnections.length), + activeConnections.length + ); + return ( <> -
{activeConnections.length} connection(s) set:
+
{msg}
{summary}
); @@ -88,7 +98,8 @@ export default function NetworkSection() { return (
{ @@ -114,8 +115,11 @@ export default function SoftwareSection({ showErrors }) { const UsedSize = () => { if (state.size === "" || state.size === "0 B") return null; + // TRANSLATORS: %s will be replaced by the estimated installation size, + // example: "728.8 MiB" + const [msg1, msg2] = _("Installation will take %s").split("%s"); return ( - <>Installation will take {state.size} + <>{msg1}{state.size}{msg2} ); }; @@ -137,7 +141,8 @@ export default function SoftwareSection({ showErrors }) { icon={} onClick={probe} > - Refresh the repositories + {/* TRANSLATORS: clickable link label */} + {_("Refresh the repositories")} } ); @@ -146,7 +151,8 @@ export default function SoftwareSection({ showErrors }) { return (
{ const { result } = proposal; - if (result === undefined) return Device not selected yet; + if (result === undefined) return {_("Device not selected yet")}; const [candidateDevice] = result.candidateDevices; const device = proposal.availableDevices.find(d => d.name === candidateDevice); const label = device ? deviceLabel(device) : candidateDevice; + // TRANSLATORS: %s will be replaced by the device name and its size, + // example: "/dev/sda, 20 GiB" + const [msg1, msg2] = _("Install using device %s and deleting all its content").split("%s"); return ( - Install using device {label} and deleting all its content + {msg1}{label}{msg2} ); }; @@ -49,7 +53,7 @@ const initialState = { busy: true, proposal: undefined, errors: [], - progress: { message: "Probing storage devices", current: 0, total: 0 } + progress: { message: _("Probing storage devices"), current: 0, total: 0 } }; const reducer = (state, action) => { @@ -156,7 +160,8 @@ export default function StorageSection({ showErrors = false }) { return (
{ return (
User {state.user.userName} will be created} - else={<>No user defined yet} + then={<>{msg1}{state.user.userName}{msg2}} + else={<>{_("No user defined yet")}} />
); @@ -95,10 +98,10 @@ export default function UsersSection({ showErrors }) { return (
- Root authentication set for using both, password and public SSH Key} /> - No root authentication method defined} /> - Root authentication set for using password} /> - Root authentication set for using public SSH Key} /> + {_("Root authentication set for using both, password and public SSH Key")}} /> + {_("No root authentication method defined")}} /> + {_("Root authentication set for using password")}} /> + {_("Root authentication set for using public SSH Key")}} />
); }; @@ -113,7 +116,8 @@ export default function UsersSection({ showErrors }) { return (