From 7c112db4e3de30188a9021a9eec6f83c197301f2 Mon Sep 17 00:00:00 2001 From: Ward from fusion-voyager-3 Date: Sun, 18 Feb 2024 23:44:12 +0300 Subject: [PATCH] RR: Translate Install Page --- po/en_US.po | 80 +++++++++++++++++++++++++++++++++++++++- src/install_page/mod.rs | 46 +++++++++++------------ src/keyboard_page/mod.rs | 16 ++++---- 3 files changed, 110 insertions(+), 32 deletions(-) diff --git a/po/en_US.po b/po/en_US.po index 6f96a30..0d6b263 100644 --- a/po/en_US.po +++ b/po/en_US.po @@ -148,4 +148,82 @@ msgid "no_locale_selected" msgstr "No locale selected" msgid "language" -msgid "Language" \ No newline at end of file +msgstr "Language" + +msgid "select_a_keyboard" +msgstr "Select a keyboard" + +msgid "please_select_keyboard" +msgstr "Please select a Keyboard layout for the system to use" + +msgid "no_keyboard_selected" +msgstr "No Keyboard Layout selected" + +msgid "test_you_keyboard" +msgstr "Test Your Keyboard here!" + +msgid "keyboard" +msgstr "Keyboard" + +msgid "luks_password_for" +msgstr "LUKS Password for " + +msgid "luks_how_should" +msgstr "How should " + +msgid "be_added_crypttab" +msgstr " be added to /etc/crypttab?" + +msgid "unlock_boot_manually" +msgstr "Unlock on boot manually" + +msgid "unlock_boot_manual" +msgstr "Automatic Unlock with root unlock" + +msgid "sit_back_relax" +msgstr "Sit back, Relax, and watch the show." + +msgid "language_detail" +msgstr "Language:" + +msgid "timezone_detail" +msgstr "Timezone:" + +msgid "keyboard_detail" +msgstr "Keyboard layout:" + +msgid "mounted_on_detail" +msgstr " mounted on " + +msgid "install_target_detail" +msgstr "Install Target:" + +msgid "confirm_install_pika" +msgstr "Confirm & Install PikaOS" + +msgid "view_logs" +msgstr "View Logs" + +msgid "parting_status_text" +msgstr "Partitioning The Target Drives." + +msgid "image_status_text" +msgstr "Writing image to target." + +msgid "flag1_status_text" +msgstr "Enabling bls_boot flag on /boot." + +msgid "flag2_status_text" +msgstr "Enabling efi flag on /boot/efi." + +msgid "crypt_status_text" +msgstr "Setting up encryption crypttab." + +msgid "lang_status_text" +msgstr "Setting Up Language and Keyboard." + +msgid "boot_status_status_text" +msgstr "Configuring bootloader." + +msgid "post_status_text" +msgstr "Running post installation script." \ No newline at end of file diff --git a/src/install_page/mod.rs b/src/install_page/mod.rs index d3157e4..6b0adf3 100644 --- a/src/install_page/mod.rs +++ b/src/install_page/mod.rs @@ -61,7 +61,7 @@ pub fn install_page( .build(); crypttab_password_listbox.add_css_class("boxed-list"); let crypttab_password = adw::PasswordEntryRow::builder() - .title("LUKS Password for ".to_owned() + &partitions.partition) + .title(gettext("luks_password_for") + &partitions.partition) .build(); crypttab_password.set_show_apply_button(true); crypttab_password_listbox.append(&crypttab_password); @@ -72,14 +72,14 @@ pub fn install_page( .width_request(400) .height_request(200) .heading( - "How should ".to_owned() + gettext("luks_how_should") + &partitions.partition - + " be added to /etc/crypttab?", + + &gettext("be_added_crypttab"), ) .build(); - crypttab_dialog.add_response("crypttab_dialog_boot", "Unlock on boot manually"); + crypttab_dialog.add_response("crypttab_dialog_boot", &gettext("unlock_boot_manually")); crypttab_dialog - .add_response("crypttab_dialog_auto", "Automatic Unlock with root unlock"); + .add_response("crypttab_dialog_auto", &gettext("unlock_boot_manual")); crypttab_dialog.set_response_enabled("crypttab_dialog_auto", false); crypttab_password.connect_apply(clone!(@weak crypttab_password, @strong partitions, @weak crypttab_dialog => move |_| { let (luks_manual_password_sender, luks_manual_password_receiver) = async_channel::unbounded(); @@ -163,7 +163,7 @@ pub fn install_page( // Next and back button let bottom_back_button = gtk::Button::builder() - .label("Back") + .label(gettext("back")) .margin_top(15) .margin_bottom(15) .margin_start(15) @@ -191,7 +191,7 @@ pub fn install_page( // the header text for the install page let install_confirm_header_text = gtk::Label::builder() - .label("Sit back, Relax, and watch the show.") + .label(gettext("sit_back_relax")) .halign(gtk::Align::End) .hexpand(true) .margin_top(15) @@ -233,7 +233,7 @@ pub fn install_page( install_confirm_details_boxed_list.add_css_class("boxed-list"); let install_confirm_detail_language = adw::ActionRow::builder() - .title("Language:") + .title(gettext("language_detail")) .subtitle( fs::read_to_string("/tmp/pika-installer-gtk4-lang.txt").expect("Unable to read file"), ) @@ -241,7 +241,7 @@ pub fn install_page( install_confirm_detail_language.add_css_class("property"); let install_confirm_detail_timezone = adw::ActionRow::builder() - .title("Time zone:") + .title(gettext("timezone_detail")) .subtitle( fs::read_to_string("/tmp/pika-installer-gtk4-timezone.txt") .expect("Unable to read file"), @@ -250,7 +250,7 @@ pub fn install_page( install_confirm_detail_timezone.add_css_class("property"); let install_confirm_detail_keyboard = adw::ActionRow::builder() - .title("Keyboard layout:") + .title(gettext("keyboard_detail")) .subtitle( fs::read_to_string("/tmp/pika-installer-gtk4-keyboard.txt") .expect("Unable to read file"), @@ -268,15 +268,15 @@ pub fn install_page( .title( "/dev/".to_owned() + &partitions.partition - + " mounted on " - + &partitions.mountpoint, + + &gettext("mounted_on_detail") + + &partitions.mountpoint ) .build(); install_confirm_details_boxed_list.append(&confirm_row); } } else { let install_confirm_detail_target = - adw::ActionRow::builder().title("Install Target:").build(); + adw::ActionRow::builder().title(gettext("install_target_detail")).build(); install_confirm_detail_target.set_subtitle( &fs::read_to_string("/tmp/pika-installer-gtk4-target-auto.txt") .expect("Unable to read file"), @@ -369,7 +369,7 @@ pub fn install_page( } let install_confirm_button = gtk::Button::builder() - .label("Confirm & Install PikaOS") + .label(gettext("confirm_install_pika")) .halign(gtk::Align::Center) .valign(gtk::Align::Center) .build(); @@ -454,7 +454,7 @@ pub fn install_page( .build(); let progress_log_button_content = adw::ButtonContent::builder() - .label("View Logs") + .label(gettext("view_logs")) .icon_name("terminal") .build(); @@ -564,7 +564,7 @@ fn begin_install( if parting_status_state == true { println!("Installation status: Parting"); install_progress_bar.set_fraction(0.20); - install_progress_bar.set_text(Some("Partitioning The Disk Target.")); + install_progress_bar.set_text(Some(&gettext("parting_status_text"))); } } })); @@ -591,7 +591,7 @@ fn begin_install( if image_status_state == true { println!("Installation status: Imaging"); install_progress_bar.set_fraction(0.60); - install_progress_bar.set_text(Some("Writing image to target.")); + install_progress_bar.set_text(Some(&gettext("image_status_text"))); } } })); @@ -618,7 +618,7 @@ fn begin_install( if flag1_status_state == true { println!("Installation status: Flag1"); install_progress_bar.set_fraction(0.65); - install_progress_bar.set_text(Some("Enabling bls_boot flag on /boot.")); + install_progress_bar.set_text(Some(&gettext("flag1_status_text"))); } } })); @@ -645,7 +645,7 @@ fn begin_install( if flag2_status_state == true { println!("Installation status: Flag2"); install_progress_bar.set_fraction(0.70); - install_progress_bar.set_text(Some("Enabling efi flag on /boot/efi.")); + install_progress_bar.set_text(Some(&gettext("flag2_status_text"))); } } })); @@ -672,7 +672,7 @@ fn begin_install( if crypt_status_state == true { println!("Installation status: Crypttab"); install_progress_bar.set_fraction(0.75); - install_progress_bar.set_text(Some("Setting up encryption crypttab.")); + install_progress_bar.set_text(Some(&gettext("crypt_status_text"))); } } })); @@ -699,7 +699,7 @@ fn begin_install( if lang_status_state == true { println!("Installation status: Language"); install_progress_bar.set_fraction(0.80); - install_progress_bar.set_text(Some("Setting Up Language and Keyboard.")); + install_progress_bar.set_text(Some(&gettext("lang_status_text"))); } } })); @@ -726,7 +726,7 @@ fn begin_install( if boot_status_state == true { println!("Installation status: Bootloader"); install_progress_bar.set_fraction(0.85); - install_progress_bar.set_text(Some("Configuring bootloader.")); + install_progress_bar.set_text(Some(&gettext("boot_status_status_text"))); } } })); @@ -753,7 +753,7 @@ fn begin_install( if post_status_state == true { println!("Installation status: Post Install"); install_progress_bar.set_fraction(0.90); - install_progress_bar.set_text(Some("Running post installation script.")); + install_progress_bar.set_text(Some(&gettext("post_status_text"))); } } })); diff --git a/src/keyboard_page/mod.rs b/src/keyboard_page/mod.rs index 3d394dd..ffff257 100644 --- a/src/keyboard_page/mod.rs +++ b/src/keyboard_page/mod.rs @@ -27,7 +27,7 @@ pub fn keyboard_page(content_stack: >k::Stack) { // Next and back button let bottom_back_button = gtk::Button::builder() - .label("Back") + .label(gettext("back")) .margin_top(15) .margin_bottom(15) .margin_start(15) @@ -36,7 +36,7 @@ pub fn keyboard_page(content_stack: >k::Stack) { .hexpand(true) .build(); let bottom_next_button = gtk::Button::builder() - .label("Next") + .label(gettext("next")) .margin_top(15) .margin_bottom(15) .margin_start(15) @@ -66,7 +66,7 @@ pub fn keyboard_page(content_stack: >k::Stack) { // the header text for the keyboard page let keyboard_header_text = gtk::Label::builder() - .label("Select a keyboard") + .label(gettext("select_a_keyboard")) .halign(gtk::Align::End) .hexpand(true) .margin_top(15) @@ -106,7 +106,7 @@ pub fn keyboard_page(content_stack: >k::Stack) { // text above keyboard selection box let keyboard_selection_text = gtk::Label::builder() - .label("Please select a Keyboard layout for the system to use") + .label(gettext("please_select_keyboard")) .halign(gtk::Align::Center) .hexpand(true) .margin_top(15) @@ -117,11 +117,11 @@ pub fn keyboard_page(content_stack: >k::Stack) { keyboard_selection_text.add_css_class("medium_sized_text"); let keyboard_selection_expander_row = adw::ExpanderRow::builder() - .title("No Keyboard Layout selected") + .title(gettext("no_keyboard_selected")) .build(); let null_checkbutton = gtk::CheckButton::builder() - .label("No Keyboard Layout selected") + .label(gettext("no_keyboard_selected")) .build(); let keyboard_selection_expander_row_viewport = @@ -234,7 +234,7 @@ pub fn keyboard_page(content_stack: >k::Stack) { .margin_top(15) .margin_end(15) .margin_start(15) - .placeholder_text("Test Your Keyboard here!") + .placeholder_text(gettext("test_you_keyboard")) .build(), ); @@ -242,7 +242,7 @@ pub fn keyboard_page(content_stack: >k::Stack) { // / Content stack appends //// Add the keyboard_main_box as page: keyboard_page, Give it nice title - content_stack.add_titled(&keyboard_main_box, Some("keyboard_page"), "Keyboard"); + content_stack.add_titled(&keyboard_main_box, Some("keyboard_page"), &gettext("keyboard")); let keyboard_data_buffer_clone = keyboard_data_buffer.clone();