From 609a19010f2c941b3e956cc3eec2810c082402c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Fri, 27 Sep 2024 13:41:21 +0100 Subject: [PATCH 1/2] fix(web): do not call '_' at module level --- .../components/storage/EncryptionField.tsx | 23 +++++------ .../storage/EncryptionSettingsDialog.tsx | 38 +++++++++---------- .../storage/InstallationDeviceField.tsx | 11 +++--- web/src/components/storage/SnapshotsField.tsx | 19 +++++----- .../storage/VolumeLocationDialog.tsx | 14 +++---- 5 files changed, 51 insertions(+), 54 deletions(-) diff --git a/web/src/components/storage/EncryptionField.tsx b/web/src/components/storage/EncryptionField.tsx index 8c43801e6..db59517e2 100644 --- a/web/src/components/storage/EncryptionField.tsx +++ b/web/src/components/storage/EncryptionField.tsx @@ -30,24 +30,18 @@ import { EncryptionMethods } from "~/types/storage"; import { _ } from "~/i18n"; import { noop } from "~/utils"; -// Field texts at root level to avoid redefinitions every time the component -// is rendered. -const LABEL = _("Encryption"); -const DESCRIPTION = _( - "Protection for the information stored at \ -the device, including data, programs, and system files.", -); -const VALUES = { +const encryptionMethods = () => ({ disabled: _("disabled"), [EncryptionMethods.LUKS2]: _("enabled"), [EncryptionMethods.TPM]: _("using TPM unlocking"), -}; +}); const Value = ({ isLoading, isEnabled, method }) => { + const values = encryptionMethods(); if (isLoading) return ; - if (isEnabled) return VALUES[method]; + if (isEnabled) return values[method]; - return VALUES.disabled; + return values.disabled; }; const Action = ({ isEnabled, isLoading, onClick }) => { @@ -107,9 +101,12 @@ export default function EncryptionField({ return ( } - description={DESCRIPTION} + description={_( + "Protection for the information stored at \ +the device, including data, programs, and system files.", + )} pfCardBodyProps={{ isFilled: true }} actions={} > diff --git a/web/src/components/storage/EncryptionSettingsDialog.tsx b/web/src/components/storage/EncryptionSettingsDialog.tsx index 9c90f554b..06f600fac 100644 --- a/web/src/components/storage/EncryptionSettingsDialog.tsx +++ b/web/src/components/storage/EncryptionSettingsDialog.tsx @@ -28,21 +28,6 @@ import { _ } from "~/i18n"; import { PasswordAndConfirmationInput, Popup } from "~/components/core"; import { EncryptionMethods } from "~/client/storage"; -const DIALOG_TITLE = _("Encryption"); -const DIALOG_DESCRIPTION = _( - "Full Disk Encryption (FDE) allows to protect the information stored \ -at the device, including data, programs, and system files.", -); -// TRANSLATORS: "Trusted Platform Module" is the name of the technology and TPM its abbreviation -const TPM_LABEL = _("Use the Trusted Platform Module (TPM) to decrypt automatically on each boot"); -// TRANSLATORS: The word 'directly' is key here. For example, booting to the installer media and then choosing -// 'Boot from Hard Disk' from there will not work. Keep it sort (this is a hint in a form) but keep it clear. -const TPM_EXPLANATION = _( - "The password will not be needed to boot and access the data if the \ -TPM can verify the integrity of the system. TPM sealing requires the new system to be booted \ -directly on its first run.", -); - export type EncryptionSetting = { password: string; method?: string; @@ -114,12 +99,27 @@ export default function EncryptionSettingsDialog({ } }; + // TRANSLATORS: "Trusted Platform Module" is the name of the technology and TPM its abbreviation + const tpm_label = _( + "Use the Trusted Platform Module (TPM) to decrypt automatically on each boot", + ); + // TRANSLATORS: The word 'directly' is key here. For example, booting to the installer media and then choosing + // 'Boot from Hard Disk' from there will not work. Keep it sort (this is a hint in a form) but keep it clear. + const tpm_explanation = _( + "The password will not be needed to boot and access the data if the \ +TPM can verify the integrity of the system. TPM sealing requires the new system to be booted \ +directly on its first run.", + ); + const tpmAvailable = methods.includes(EncryptionMethods.TPM); return ( @@ -140,8 +140,8 @@ export default function EncryptionSettingsDialog({ {tpmAvailable && ( ; else value = targetValue(target, targetDevice, targetPVDevices); + // TRANSLATORS: The storage "Installation device" field's description. + const description = _("Main disk or LVM Volume Group for installation."); + return ( diff --git a/web/src/components/storage/SnapshotsField.tsx b/web/src/components/storage/SnapshotsField.tsx index 9e2ae97e3..1235e3b81 100644 --- a/web/src/components/storage/SnapshotsField.tsx +++ b/web/src/components/storage/SnapshotsField.tsx @@ -29,12 +29,6 @@ import { hasFS } from "~/components/storage/utils"; import textStyles from "@patternfly/react-styles/css/utilities/Text/text"; import { Volume } from "~/types/storage"; -const LABEL = _("Use Btrfs snapshots for the root file system"); -const DESCRIPTION = _( - "Allows to boot to a previous version of the \ -system after configuration changes or software upgrades.", -); - export type SnapshotsFieldProps = { rootVolume: Volume; onChange?: (config: SnapshotsConfig) => void; @@ -51,6 +45,8 @@ export type SnapshotsConfig = { export default function SnapshotsField({ rootVolume, onChange }: SnapshotsFieldProps) { const isChecked = hasFS(rootVolume, "Btrfs") && rootVolume.snapshots; + const label = _("Use Btrfs snapshots for the root file system"); + const switchState = () => { if (onChange) onChange({ active: !isChecked }); }; @@ -59,14 +55,19 @@ export default function SnapshotsField({ rootVolume, onChange }: SnapshotsFieldP
-
{LABEL}
-
{DESCRIPTION}
+
{label}
+
+ {_( + "Allows to boot to a previous version of the \ +system after configuration changes or software upgrades.", + )} +
); diff --git a/web/src/components/storage/VolumeLocationDialog.tsx b/web/src/components/storage/VolumeLocationDialog.tsx index 741d6dc7f..4d78c854c 100644 --- a/web/src/components/storage/VolumeLocationDialog.tsx +++ b/web/src/components/storage/VolumeLocationDialog.tsx @@ -29,12 +29,6 @@ import { sprintf } from "sprintf-js"; import { deviceChildren, volumeLabel } from "~/components/storage/utils"; import { StorageDevice, Volume, VolumeTarget } from "~/types/storage"; -// TRANSLATORS: Description of the dialog for changing the location of a file system. -const DIALOG_DESCRIPTION = _( - "The file systems are allocated at the installation device by \ -default. Indicate a custom location to create the file system at a specific device.", -); - const defaultTarget: (device: StorageDevice | undefined) => VolumeTarget = ( device, ): VolumeTarget => { @@ -130,12 +124,18 @@ export default function VolumeLocationDialog({ if (!targetDevice) return null; + // TRANSLATORS: Description of the dialog for changing the location of a file system. + const dialogDescription = _( + "The file systems are allocated at the installation device by \ +default. Indicate a custom location to create the file system at a specific device.", + ); + return ( Date: Fri, 27 Sep 2024 14:01:37 +0100 Subject: [PATCH 2/2] doc(web): update changes file --- web/package/agama-web-ui.changes | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/package/agama-web-ui.changes b/web/package/agama-web-ui.changes index 21673509a..36fbf9539 100644 --- a/web/package/agama-web-ui.changes +++ b/web/package/agama-web-ui.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Sep 27 13:00:05 UTC 2024 - Imobach Gonzalez Sosa + +- Properly translate the storage interface when switching + the language of the UI (gh#agama-project/agama#1629). + ------------------------------------------------------------------- Fri Sep 20 11:42:25 UTC 2024 - Imobach Gonzalez Sosa