From 00cadafc29b3169eadef15aca94f8ea4b91cd7ad Mon Sep 17 00:00:00 2001 From: Ward from fusion-voyager-3 Date: Sun, 18 Feb 2024 22:36:24 +0300 Subject: [PATCH] RR: Translate Manual partition page --- data/scripts/automatic-partition-install.sh | 2 + data/scripts/begin-install.sh | 2 + data/scripts/manual-partition-install.sh | 2 + data/scripts/partition-utility.sh | 2 + po/en_US.po | 83 +++++++++++++++++++++ src/automatic_partitioning/mod.rs | 2 +- src/manual_partitioning/mod.rs | 71 +++++++++--------- 7 files changed, 127 insertions(+), 37 deletions(-) diff --git a/data/scripts/automatic-partition-install.sh b/data/scripts/automatic-partition-install.sh index f5d3c27..2fa961e 100644 --- a/data/scripts/automatic-partition-install.sh +++ b/data/scripts/automatic-partition-install.sh @@ -1,5 +1,7 @@ #! /bin/bash +export LANG=en_US.UTF8 + set -e DISK="$(cat "/tmp/pika-installer-gtk4-target-auto.txt")" diff --git a/data/scripts/begin-install.sh b/data/scripts/begin-install.sh index 5f2bc3f..9cd80b6 100644 --- a/data/scripts/begin-install.sh +++ b/data/scripts/begin-install.sh @@ -1,5 +1,7 @@ #! /bin/bash +export LANG=en_US.UTF8 + exec &> >(tee /tmp/pika-installer-gtk4-log) if [[ -f /tmp/pika-installer-gtk4-target-manual.txt ]] diff --git a/data/scripts/manual-partition-install.sh b/data/scripts/manual-partition-install.sh index 8055830..cbb164e 100644 --- a/data/scripts/manual-partition-install.sh +++ b/data/scripts/manual-partition-install.sh @@ -1,5 +1,7 @@ #! /bin/bash +export LANG=en_US.UTF8 + set -e LOCALE="$(cat "/tmp/pika-installer-gtk4-lang.txt")" diff --git a/data/scripts/partition-utility.sh b/data/scripts/partition-utility.sh index 28b48da..171e457 100755 --- a/data/scripts/partition-utility.sh +++ b/data/scripts/partition-utility.sh @@ -1,5 +1,7 @@ #! /bin/bash +export LANG=en_US.UTF8 + if [[ "$1" = "get_block_devices" ]] then lsblk -dn -o NAME | grep -v -i -E 'loop|zram|sr|cdrom|portal' diff --git a/po/en_US.po b/po/en_US.po index cbd9793..f72547c 100644 --- a/po/en_US.po +++ b/po/en_US.po @@ -54,3 +54,86 @@ msgstr "Manually Partition The Drive" msgid "auto_partition_drive" msgstr "Automatically Partition\nThe Drive" +msgid "manual_part_installer" +msgstr "Manual Partitioning Installer" + +msgid "use_utility_manual" +msgstr "Use this utility to partition/mount/format your drives." + +msgid "open_gparted" +msgstr "Open GPARTED" + +msgid "manual_part_note" +msgstr "\n - Press the plus button below to begin adding filesystem entries.\nNotes:\n - This installer doesn't erase any data automatically, format your drives manually via gparted.\n - To Add a linux-swap partition set mountpoint to [SWAP]\n - We recommend the following partitions as a base layout:\n /boot ~ 1000mb ext4.\n /boot/efi ~ 512mb vfat/fat32.\n / >= 25GB btrfs.\n " + +msgid "refresh_part_table" +msgstr "Refresh Partition Table" + +msgid "validate_fs_table" +msgstr "Validate Filesystem Table" + +msgid "fstab_status_valid" +msgstr "Filesystem Table Status: All entries are valid!" + +msgid "part_need_mapper" +msgstr "This partition needs a mapper!" + +msgid "fstab_subvol_warn" +msgstr "Filesystem Table Warning: Partition reuse check will be skipped due to subvol usage." + +msgid "fstab_multiple_part_mountpoint_err" +msgstr "Filesystem Table Error: Multiple partitions are configured to the same mountpoint!" + +msgid "fstab_no_mountpoint_err" +msgstr "Filesystem Table Error: One or more partitions don't have a mountpoint configured!" + +msgid "fstab_no_partition_err" +msgstr "Filesystem Table Error: One or more entries don't have a partition configured!" + +msgid "fstab_badfs" +msgstr "Filesystem Table Error: Invalid filesystem: (/dev/" + +msgstr "fstab_small_efi_err" +msgstr "Filesystem Table Error: Small size: The partition mounted to /boot/efi (/dev/" + +msgid "fstab_small_efi_size" +msgstr ") Must at least be 512MBs!" + +msgid "fstab_badfs_efi" +msgstr ") Must be FAT32/vFAT to be mounted at /boot/efi!" + +msgstr "fstab_small_boot_err" +msgstr "Filesystem Table Error: Small size: The partition mounted to /boot (/dev/" + +msgid "fstab_small_boot_size" +msgstr ") Must at least be 1GBs!" + +msgid "fstab_badfs_boot" +msgstr ") Must not be FAT32/vFAT to be mounted at /boot!" + +msgstr "fstab_small_root_err" +msgstr "Filesystem Table Error: Small size: The partition mounted to / (/dev/" + +msgid "fstab_small_root_size" +msgstr ") Must at least be 26GBs!" + +msgid "fstab_badfs_root" +msgstr ") Must be a Linux* compatible filesystem such as:\n ext4/btrfs/xfs/f2fs to be mounted at /!" + +msgstr "fstab_small_home_err" +msgstr "Filesystem Table Error: Small size: The partition mounted to /home (/dev/" + +msgid "fstab_small_home_size" +msgstr ") Must at least be 11GBs!" + +msgid "fstab_badfs_home" +msgstr ") Must be a Linux* compatible filesystem such as:\n ext4/btrfs/xfs/f2fs to be mounted at /home!" + +msgid "fstab_badfs_swap" +msgstr ") Must not be swap to be used as [SWAP]!" + +msgid "fstab_bad_mountpoint" +msgstr "Filesystem Table Error: Invalid mountpoint: (" + +msgid "fstab_bad_mountpoint_msg" +msgstr ") Is not a valid mountpoint!" \ No newline at end of file diff --git a/src/automatic_partitioning/mod.rs b/src/automatic_partitioning/mod.rs index 85eada3..b50da21 100644 --- a/src/automatic_partitioning/mod.rs +++ b/src/automatic_partitioning/mod.rs @@ -43,7 +43,7 @@ pub fn automatic_partitioning( // the header icon for the partitioning icon let partition_method_automatic_header_icon = gtk::Image::builder() - .icon_name("media-playlist-shuffle") + .icon_name("builder") .halign(gtk::Align::Start) .hexpand(true) .pixel_size(78) diff --git a/src/manual_partitioning/mod.rs b/src/manual_partitioning/mod.rs index 03a1214..4e5bc4c 100644 --- a/src/manual_partitioning/mod.rs +++ b/src/manual_partitioning/mod.rs @@ -84,7 +84,7 @@ fn create_mount_row( .activatable_widget(&partition_button) .title(partition.clone()) .name(partition.clone()) - .subtitle("This partition needs a mapper!") + .subtitle(gettext("part_need_mapper")) .build(); prow } else { @@ -151,7 +151,7 @@ pub fn manual_partitioning( // the header text for the partitioning page let partition_method_manual_header_text = gtk::Label::builder() - .label("Manual Partitioning Installer") + .label(gettext("manual_part_installer")) .halign(gtk::Align::End) .hexpand(true) .margin_top(15) @@ -163,7 +163,7 @@ pub fn manual_partitioning( // the header icon for the partitioning icon let partition_method_manual_header_icon = gtk::Image::builder() - .icon_name("input-tablet") + .icon_name("org.gnome.Settings") .halign(gtk::Align::Start) .hexpand(true) .pixel_size(78) @@ -182,11 +182,11 @@ pub fn manual_partitioning( .build(); let partition_method_manual_gparted_button_content_text = gtk::Label::builder() - .label("Use this utility to partition/mount/format your drives.") + .label(gettext("use_utility_manual")) .build(); let partition_method_manual_gparted_button_content = adw::ButtonContent::builder() - .label("Open GPARTED") + .label(gettext("open_gparted")) .icon_name("gparted") .build(); @@ -216,7 +216,7 @@ pub fn manual_partitioning( .build(); let partition_method_manual_selection_text = gtk::Label::builder() - .label("\n - Press the plus button below to begin adding filesystem entries.\nNotes:\n - This installer doesn't erase any data automatically, format your drives manually via gparted.\n - To Add a linux-swap partition set mountpoint to [SWAP]\n - We recommend the following partitions as a base layout:\n /boot ~ 1000mb ext4.\n /boot/efi ~ 512mb vfat/fat32.\n / >= 25GB btrfs.\n ") + .label(gettext("manual_part_note")) .halign(gtk::Align::Center) .hexpand(true) .margin_top(15) @@ -227,13 +227,13 @@ pub fn manual_partitioning( partition_method_manual_selection_text.add_css_class("medium_sized_text"); let partition_refresh_button = gtk::Button::builder() - .label("Refresh Partition Table") + .label(gettext("refresh_part_table")) .halign(gtk::Align::End) .build(); partition_refresh_button.add_css_class("destructive-action"); let fstab_valid_check = gtk::Button::builder() - .label("Validate Filesystem Table") + .label(gettext("validate_fs_table")) .halign(gtk::Align::Start) .build(); fstab_valid_check.add_css_class("valid-action"); @@ -257,7 +257,7 @@ pub fn manual_partitioning( .valign(Align::End) .vexpand(true) .visible(false) - .label("Filesystem Table is valid!") + .label(gettext("fstab_status_valid")) .build(); partition_method_manual_valid_label.add_css_class("small_valid_text"); @@ -366,13 +366,13 @@ pub fn manual_partitioning( if *check_part_unique.borrow_mut() == true { row_scrw.set_sensitive(false) - } else if row_scrw.property::("subtitle").contains("This partition needs a mapper!") { + } else if row_scrw.property::("subtitle").contains(&gettext("part_need_mapper")) { row_scrw.set_sensitive(false) } else { row_scrw.set_sensitive(true) } } - else if row_scrw.property::("subtitle").contains("This partition needs a mapper!") { + else if row_scrw.property::("subtitle").contains(&gettext("part_need_mapper")) { row_scrw.set_sensitive(false) } else { row_scrw.set_sensitive(true) @@ -397,7 +397,7 @@ pub fn manual_partitioning( if *check_part_unique.borrow_mut() == false { partition_method_manual_warn_label - .set_label("Partition reuse check will be skipped due to subvol usage."); + .set_label(&gettext("fstab_subvol_warn")); partition_method_manual_warn_label.set_visible(true); } else { partition_method_manual_warn_label.set_visible(false); @@ -474,7 +474,7 @@ fn partition_err_check( { if !partition_method_manual_error_label.is_visible() { partition_method_manual_error_label - .set_label("Multiple drives were mounted to the same mountpoint."); + .set_label(&gettext("fstab_multiple_part_mountpoint_err")); partition_method_manual_error_label.set_visible(true); partition_method_manual_error_label.set_widget_name("err0"); } @@ -486,7 +486,7 @@ fn partition_err_check( } else { if !partition_method_manual_error_label.is_visible() { partition_method_manual_error_label - .set_label("Some drives don't have a mountpoint configured."); + .set_label(&gettext("fstab_no_mountpoint_err")); partition_method_manual_error_label.set_widget_name("err1"); partition_method_manual_error_label.set_visible(true); } @@ -495,7 +495,7 @@ fn partition_err_check( if empty_partition == true { if !partition_method_manual_error_label.is_visible() { partition_method_manual_error_label - .set_label("There's a drive row without a partition."); + .set_label(&gettext("fstab_no_partition_err")); partition_method_manual_error_label.set_widget_name("err2"); partition_method_manual_error_label.set_visible(true); } @@ -538,9 +538,9 @@ fn partition_err_check( if partition_size < 500000000.0 { if !partition_method_manual_error_label.is_visible() { partition_method_manual_error_label.set_label( - &("Small size: The partition mounted to /boot/efi (/dev/".to_owned() + &(gettext("fstab_small_efi_err") + &drivemounts.partition - + ") Must at least be 512MBs"), + + &gettext("fstab_small_efi_size")), ); partition_method_manual_error_label.set_visible(true); partition_method_manual_error_label.set_widget_name("err3"); @@ -553,10 +553,9 @@ fn partition_err_check( if partition_fs != "vfat" { if !partition_method_manual_error_label.is_visible() { partition_method_manual_error_label.set_label( - &("Bad Filesystem: The partition mounted to /boot/efi (/dev/" - .to_owned() + &(gettext("fstab_badfs") + &drivemounts.partition - + ") Must at be FAT32/vFAT"), + + &gettext("fstab_badfs_efi")), ); partition_method_manual_error_label.set_visible(true); partition_method_manual_error_label.set_widget_name("err4"); @@ -571,9 +570,9 @@ fn partition_err_check( if partition_size < 1000000000.0 { if !partition_method_manual_error_label.is_visible() { partition_method_manual_error_label.set_label( - &("Small size: The partition mounted to /boot (/dev/".to_owned() + &(gettext("fstab_small_boot_err") + &drivemounts.partition - + ") Must at least be 1000MBs"), + + &gettext("fstab_small_boot_size")), ); partition_method_manual_error_label.set_visible(true); partition_method_manual_error_label.set_widget_name("err5"); @@ -586,9 +585,9 @@ fn partition_err_check( if partition_fs == "vfat" { if !partition_method_manual_error_label.is_visible() { partition_method_manual_error_label.set_label( - &("Bad Filesystem: The partition mounted to /boot (/dev/".to_owned() + &(gettext("fstab_badfs") + &drivemounts.partition - + ") Cannot be FAT32/vFAT"), + + &gettext("fstab_badfs_boot")), ); partition_method_manual_error_label.set_visible(true); partition_method_manual_error_label.set_widget_name("err6"); @@ -603,9 +602,9 @@ fn partition_err_check( if partition_size < 25000000000.0 { if !partition_method_manual_error_label.is_visible() { partition_method_manual_error_label.set_label( - &("Small size: The partition mounted to / (/dev/".to_owned() + &(gettext("fstab_small_root_err") + &drivemounts.partition - + ") Must at least be 25GBs"), + + &gettext("fstab_small_root_size")), ); partition_method_manual_error_label.set_visible(true); partition_method_manual_error_label.set_widget_name("err7") @@ -618,9 +617,9 @@ fn partition_err_check( if partition_fs == "vfat" || partition_fs == "ntfs" || partition_fs == "swap" || partition_fs == "exfat" { if !partition_method_manual_error_label.is_visible() { partition_method_manual_error_label.set_label( - &("Bad Filesystem: The partition mounted to / (/dev/".to_owned() + &(gettext("fstab_badfs") + &drivemounts.partition - + ") Has an Invalid Filesystem"), + + &gettext("fstab_badfs_root")), ); partition_method_manual_error_label.set_visible(true); partition_method_manual_error_label.set_widget_name("err8"); @@ -635,9 +634,9 @@ fn partition_err_check( if partition_size < 10000000000.0 { if !partition_method_manual_error_label.is_visible() { partition_method_manual_error_label.set_label( - &("Small size: The partition mounted to /home (/dev/".to_owned() + &(gettext("fstab_small_home_err") + &drivemounts.partition - + ") Must at least be 10GBs"), + + &gettext("fstab_small_home_size")), ); partition_method_manual_error_label.set_visible(true); partition_method_manual_error_label.set_widget_name("err9"); @@ -650,9 +649,9 @@ fn partition_err_check( if partition_fs == "vfat" || partition_fs == "ntfs" || partition_fs == "swap" || partition_fs == "exfat" { if !partition_method_manual_error_label.is_visible() { partition_method_manual_error_label.set_label( - &("Bad Filesystem: The partition mounted to /home (/dev/".to_owned() + &(gettext("fstab_badfs") + &drivemounts.partition - + ") Has an Invalid Filesystem"), + + &gettext("fstab_badfs_home")), ); partition_method_manual_error_label.set_visible(true); partition_method_manual_error_label.set_widget_name("err10"); @@ -667,9 +666,9 @@ fn partition_err_check( if partition_fs != "swap" { if !partition_method_manual_error_label.is_visible() { partition_method_manual_error_label.set_label( - &("Bad Filesystem: ".to_owned() + &(gettext("fstab_badfs") + &drivemounts.partition - + " Is not a swap partition"), + + &gettext("fstab_badfs_swap")), ); partition_method_manual_error_label.set_visible(true); partition_method_manual_error_label.set_widget_name("err11"); @@ -687,9 +686,9 @@ fn partition_err_check( { if !partition_method_manual_error_label.is_visible() { partition_method_manual_error_label.set_label( - &("Bad Mountpoint: ".to_owned() + &(gettext("fstab_bad_mountpoint") + &drivemounts.mountpoint - + " Is not a valid mountpoint"), + + &gettext("fstab_bad_mountpoint_msg")), ); partition_method_manual_error_label.set_visible(true); partition_method_manual_error_label.set_widget_name("err12");