RR: Begin Translation Process for few stacks and use err id based problem detection in manual partitioning

This commit is contained in:
Ward from fusion-voyager-3 2024-02-18 21:30:41 +03:00
parent cfcebe2d7b
commit 90941b2eb1
13 changed files with 106 additions and 84 deletions

View File

@ -14,3 +14,43 @@ msgstr ""
msgid "pikaos_installer"
msgstr "PikaOS Installer"
msgid "welcome_to_pikaos"
msgstr "Welcome to PikaOS"
msgid "use_pikaos_in_live_media"
msgstr "Use PikaOS in Live media"
msgid "install_distro_to_system"
msgstr "Install Distro to System"
msgid "welcome"
msgstr "Welcome"
msgid "back"
msgstr "Back"
msgid "next"
msgstr "Next"
msgid "select_a_timezone"
msgstr "Select a timezone"
msgid "please_select_timezone"
msgstr "Please select a Time Zone for the system to use"
msgid "no_timezone_select"
msgstr "No Time Zone selected"
msgid "timezone"
msgstr "Time Zone"
msgid "choose_install_method"
msgstr "Choose an install method"
msgid "manual_partition_drive"
msgstr "Manually Partition The Drive"
msgid "auto_partition_drive"
msgstr "Automatically Partition\nThe Drive"

View File

@ -6,7 +6,7 @@ use glib::*;
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
use gtk::*;
use gettextrs::{gettext, LocaleCategory};
use gettextrs::{gettext};
use std::io::BufRead;
use std::io::BufReader;

View File

@ -6,7 +6,7 @@ use glib::*;
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
use gtk::*;
use gettextrs::{gettext, LocaleCategory};
use gettextrs::{gettext};
use std::path::Path;
@ -30,7 +30,7 @@ use crate::partitioning_page::partitioning_page;
pub fn build_ui(app: &adw::Application) {
// setup glib
gtk::glib::set_prgname(Some(gettext("pikaos_installer")));
glib::set_application_name("PikaOS Installer");
glib::set_application_name(&gettext("pikaos_installer"));
let glib_settings = gio::Settings::new("com.github.pikaos-linux.pikainstallergtk4");
// Widget Bank
@ -67,7 +67,7 @@ pub fn build_ui(app: &adw::Application) {
let window = adw::ApplicationWindow::builder()
// The text on the titlebar
.title("PikaOS Installer")
.title(gettext("pikaos_installer"))
// link it to the application "app"
.application(app)
// Add the box called "_main_box" to it

View File

@ -7,7 +7,7 @@ use glib::*;
use gtk::*;
use crate::config::{DISTRO_ICON};
use gettextrs::{gettext, LocaleCategory};
use gettextrs::{gettext};
use std::path::Path;
use std::process::Command;

View File

@ -8,7 +8,7 @@ use adw::{prelude::*, subclass::prelude::*, *};
use glib::{clone, subclass::Signal, Properties};
use gtk::{glib, Orientation::Horizontal};
use gettextrs::{gettext, LocaleCategory};
use gettextrs::{gettext};
// ANCHOR: custom_button
// Object holding the state
@ -123,7 +123,7 @@ impl ObjectImpl for DriveMountRow {
.width_request(53)
.height_request(53)
.valign(gtk::Align::Start)
.icon_name("edit-delete")
.icon_name("user-trash")
.halign(gtk::Align::End)
.build();

View File

@ -6,7 +6,7 @@ use glib::*;
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
use gtk::*;
use gettextrs::{gettext, LocaleCategory};
use gettextrs::{gettext};
pub fn efi_error_page(window: &adw::ApplicationWindow, content_stack: &gtk::Stack) {
// the header box for the efi_error page

View File

@ -6,7 +6,7 @@ use glib::*;
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
use gtk::*;
use gettextrs::{gettext, LocaleCategory};
use gettextrs::{gettext};
pub fn eula_page(content_stack: &gtk::Stack) {
// create the bottom box for next and back buttons

View File

@ -10,7 +10,7 @@ use gtk::*;
use vte::prelude::*;
use vte::*;
use gettextrs::{gettext, LocaleCategory};
use gettextrs::{gettext};
use crate::done_page::done_page;

View File

@ -6,7 +6,7 @@ use glib::*;
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
use gtk::*;
use gettextrs::{gettext, LocaleCategory};
use gettextrs::{gettext};
use std::io::BufRead;
use std::io::BufReader;

View File

@ -7,7 +7,7 @@ use glib::*;
use gtk::*;
use std::thread;
use gettextrs::{gettext, LocaleCategory};
use gettextrs::{gettext};
use std::cell::{RefCell};
use std::rc::Rc;
@ -116,6 +116,7 @@ fn create_mount_row(
closure_local!(@strong partition_method_manual_error_label ,@strong partition_method_manual_valid_label, @strong row as _row => move |_row: DriveMountRow| {
listbox_clone.remove(&_row);
partition_method_manual_error_label.set_label("");
partition_method_manual_error_label.set_widget_name("");
partition_method_manual_error_label.set_visible(false);
partition_method_manual_valid_label.set_label("");
partition_method_manual_valid_label.set_visible(false);
@ -458,8 +459,8 @@ fn partition_err_check(
}
if empty_mountpoint == false {
if &partition_method_manual_error_label.label()
== "Some drives don't have a mountpoint configured."
if &partition_method_manual_error_label.widget_name()
== "err1"
{
partition_method_manual_error_label.set_visible(false);
}
@ -475,11 +476,10 @@ fn partition_err_check(
partition_method_manual_error_label
.set_label("Multiple drives were mounted to the same mountpoint.");
partition_method_manual_error_label.set_visible(true);
partition_method_manual_error_label.set_widget_name("err0");
}
} else {
if partition_method_manual_error_label.label()
== "Multiple drives were mounted to the same mountpoint."
{
if &partition_method_manual_error_label.widget_name() == "err0" {
partition_method_manual_error_label.set_visible(false);
}
}
@ -487,6 +487,7 @@ fn partition_err_check(
if !partition_method_manual_error_label.is_visible() {
partition_method_manual_error_label
.set_label("Some drives don't have a mountpoint configured.");
partition_method_manual_error_label.set_widget_name("err1");
partition_method_manual_error_label.set_visible(true);
}
}
@ -495,10 +496,11 @@ fn partition_err_check(
if !partition_method_manual_error_label.is_visible() {
partition_method_manual_error_label
.set_label("There's a drive row without a partition.");
partition_method_manual_error_label.set_widget_name("err2");
partition_method_manual_error_label.set_visible(true);
}
} else {
if partition_method_manual_error_label.label() == "There's a drive row without a partition."
if partition_method_manual_error_label.widget_name() == "err2"
{
partition_method_manual_error_label.set_visible(false);
}
@ -541,12 +543,10 @@ fn partition_err_check(
+ ") Must at least be 512MBs"),
);
partition_method_manual_error_label.set_visible(true);
partition_method_manual_error_label.set_widget_name("err3");
}
} else {
if partition_method_manual_error_label
.label()
.contains("Small size: The partition mounted to /boot/efi (/dev/")
{
if &partition_method_manual_error_label.widget_name() == "err3" {
partition_method_manual_error_label.set_visible(false);
}
}
@ -559,12 +559,10 @@ fn partition_err_check(
+ ") Must at be FAT32/vFAT"),
);
partition_method_manual_error_label.set_visible(true);
partition_method_manual_error_label.set_widget_name("err4");
}
} else {
if partition_method_manual_error_label
.label()
.contains("Bad Filesystem: The partition mounted to /boot/efi (/dev/")
{
if &partition_method_manual_error_label.widget_name() == "err4" {
partition_method_manual_error_label.set_visible(false);
}
}
@ -578,12 +576,10 @@ fn partition_err_check(
+ ") Must at least be 1000MBs"),
);
partition_method_manual_error_label.set_visible(true);
partition_method_manual_error_label.set_widget_name("err5");
}
} else {
if partition_method_manual_error_label
.label()
.contains("Small size: The partition mounted to /boot (/dev/")
{
if &partition_method_manual_error_label.widget_name() == "err5" {
partition_method_manual_error_label.set_visible(false);
}
}
@ -595,12 +591,10 @@ fn partition_err_check(
+ ") Cannot be FAT32/vFAT"),
);
partition_method_manual_error_label.set_visible(true);
partition_method_manual_error_label.set_widget_name("err6");
}
} else {
if partition_method_manual_error_label
.label()
.contains("Bad Filesystem: The partition mounted to /boot (/dev/")
{
if &partition_method_manual_error_label.widget_name() == "err6" {
partition_method_manual_error_label.set_visible(false);
}
}
@ -614,16 +608,14 @@ fn partition_err_check(
+ ") Must at least be 25GBs"),
);
partition_method_manual_error_label.set_visible(true);
partition_method_manual_error_label.set_widget_name("err7")
}
} else {
if partition_method_manual_error_label
.label()
.contains("Small size: The partition mounted to / (/dev/")
{
if &partition_method_manual_error_label.widget_name() == "err7" {
partition_method_manual_error_label.set_visible(false);
}
}
if partition_fs == "vfat" || partition_fs == "vfat" || partition_fs == "ntfs" || partition_fs == "swap" || partition_fs == "exfat" {
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()
@ -631,12 +623,10 @@ fn partition_err_check(
+ ") Has an Invalid Filesystem"),
);
partition_method_manual_error_label.set_visible(true);
partition_method_manual_error_label.set_widget_name("err8");
}
} else {
if partition_method_manual_error_label
.label()
.contains("Bad Filesystem: The partition mounted to / (/dev/")
{
if &partition_method_manual_error_label.widget_name() == "err8" {
partition_method_manual_error_label.set_visible(false);
}
}
@ -650,29 +640,25 @@ fn partition_err_check(
+ ") Must at least be 10GBs"),
);
partition_method_manual_error_label.set_visible(true);
partition_method_manual_error_label.set_widget_name("err9");
}
} else {
if partition_method_manual_error_label
.label()
.contains("Small size: The partition mounted to /home (/dev/")
{
if &partition_method_manual_error_label.widget_name() == "err9" {
partition_method_manual_error_label.set_visible(false);
}
}
if partition_fs == "vfat" {
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()
+ &drivemounts.partition
+ ") Cannot be FAT32/vFAT"),
+ ") Has an Invalid Filesystem"),
);
partition_method_manual_error_label.set_visible(true);
partition_method_manual_error_label.set_widget_name("err10");
}
} else {
if partition_method_manual_error_label
.label()
.contains("Bad Filesystem: The partition mounted to /home (/dev/")
{
if &partition_method_manual_error_label.widget_name() == "err10" {
partition_method_manual_error_label.set_visible(false);
}
}
@ -686,12 +672,10 @@ fn partition_err_check(
+ " Is not a swap partition"),
);
partition_method_manual_error_label.set_visible(true);
partition_method_manual_error_label.set_widget_name("err11");
}
} else {
if partition_method_manual_error_label
.label()
.contains(" Is not a swap partition")
{
if &partition_method_manual_error_label.widget_name() == "err11" {
partition_method_manual_error_label.set_visible(false);
}
}
@ -708,12 +692,10 @@ fn partition_err_check(
+ " Is not a valid mountpoint"),
);
partition_method_manual_error_label.set_visible(true);
partition_method_manual_error_label.set_widget_name("err12");
}
} else {
if partition_method_manual_error_label
.label()
.contains(" Is not a valid mountpoint")
{
if &partition_method_manual_error_label.widget_name() == "err12" {
partition_method_manual_error_label.set_visible(false);
}
}

View File

@ -7,7 +7,7 @@ use glob::glob;
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
use gtk::*;
use gettextrs::{gettext, LocaleCategory};
use gettextrs::{gettext};
use crate::automatic_partitioning::automatic_partitioning;
use crate::install_page::install_page;
@ -42,7 +42,7 @@ pub fn partitioning_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)
@ -51,7 +51,7 @@ pub fn partitioning_page(
.hexpand(true)
.build();
let bottom_next_button = gtk::Button::builder()
.label("Next")
.label(gettext("next"))
.margin_top(15)
.margin_bottom(15)
.margin_start(15)
@ -81,7 +81,7 @@ pub fn partitioning_page(
// the header text for the partitioning page
let partitioning_header_text = gtk::Label::builder()
.label("Choose an install method")
.label(gettext("choose_install_method"))
.halign(gtk::Align::End)
.hexpand(true)
.margin_top(15)
@ -125,7 +125,7 @@ pub fn partitioning_page(
.build();
let manual_method_button_content_image = gtk::Image::builder()
.icon_name("input-tablet")
.icon_name("org.gnome.Settings")
.pixel_size(128)
.margin_top(15)
.margin_bottom(15)
@ -134,7 +134,7 @@ pub fn partitioning_page(
.build();
let manual_method_button_content_text = gtk::Label::builder()
.label("Manually Partition The Drive")
.label(gettext("manual_partition_drive"))
.margin_top(0)
.margin_bottom(15)
.margin_start(15)
@ -151,7 +151,7 @@ pub fn partitioning_page(
.build();
let automatic_method_button_content_image = gtk::Image::builder()
.icon_name("media-playlist-shuffle")
.icon_name("builder")
.pixel_size(128)
.margin_top(15)
.margin_bottom(15)
@ -160,7 +160,7 @@ pub fn partitioning_page(
.build();
let automatic_method_button_content_text = gtk::Label::builder()
.label("Automatically Partition\nThe Drive")
.label(gettext("auto_partition_drive"))
.margin_top(0)
.margin_bottom(15)
.margin_start(15)

View File

@ -6,7 +6,7 @@ use glib::*;
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
use gtk::*;
use gettextrs::{gettext, LocaleCategory};
use gettextrs::{gettext};
use std::io::BufRead;
use std::io::BufReader;
@ -27,7 +27,7 @@ pub fn timezone_page(content_stack: &gtk::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 timezone_page(content_stack: &gtk::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 timezone_page(content_stack: &gtk::Stack) {
// the header text for the timezone page
let timezone_header_text = gtk::Label::builder()
.label("Select a timezone")
.label(gettext("select_a_timezone"))
.halign(gtk::Align::End)
.hexpand(true)
.margin_top(15)
@ -78,7 +78,7 @@ pub fn timezone_page(content_stack: &gtk::Stack) {
// the header icon for the timezone icon
let timezone_header_icon = gtk::Image::builder()
.icon_name("clock")
.icon_name("alarm-clock")
.halign(gtk::Align::Start)
.hexpand(true)
.pixel_size(78)
@ -106,7 +106,7 @@ pub fn timezone_page(content_stack: &gtk::Stack) {
// text above timezone selection box
let timezone_selection_text = gtk::Label::builder()
.label("Please select a Time Zone for the system to use")
.label(gettext("please_select_timezone"))
.halign(gtk::Align::Center)
.hexpand(true)
.margin_top(15)
@ -117,11 +117,11 @@ pub fn timezone_page(content_stack: &gtk::Stack) {
timezone_selection_text.add_css_class("medium_sized_text");
let timezone_selection_expander_row = adw::ExpanderRow::builder()
.title("No Time Zone selected")
.title(gettext("no_timezone_select"))
.build();
let null_checkbutton = gtk::CheckButton::builder()
.label("No Time Zone selected")
.label(gettext("no_timezone_select"))
.build();
let timezone_selection_expander_row_viewport =
@ -213,7 +213,7 @@ pub fn timezone_page(content_stack: &gtk::Stack) {
// / Content stack appends
//// Add the timezone_main_box as page: timezone_page, Give it nice title
content_stack.add_titled(&timezone_main_box, Some("timezone_page"), "Time Zone");
content_stack.add_titled(&timezone_main_box, Some("timezone_page"), &gettext("timezone"));
let timezone_data_buffer_clone = timezone_data_buffer.clone();

View File

@ -7,7 +7,7 @@ use glib::*;
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
use gtk::*;
use gettextrs::{gettext, LocaleCategory};
use gettextrs::{gettext};
pub fn welcome_page(window: &adw::ApplicationWindow, content_stack: &gtk::Stack) {
// the header box for the welcome page
@ -22,7 +22,7 @@ pub fn welcome_page(window: &adw::ApplicationWindow, content_stack: &gtk::Stack)
// the header text for the welcome page
let welcome_header_text = gtk::Label::builder()
.label("Welcome to PikaOS")
.label(gettext("welcome_to_pikaos"))
.halign(gtk::Align::End)
.hexpand(true)
.margin_top(15)
@ -64,7 +64,7 @@ pub fn welcome_page(window: &adw::ApplicationWindow, content_stack: &gtk::Stack)
.build();
let live_media_button_content_text = gtk::Label::builder()
.label("Use PikaOS in Live media")
.label(gettext("use_pikaos_in_live_media"))
.margin_top(0)
.margin_bottom(15)
.margin_start(15)
@ -86,7 +86,7 @@ pub fn welcome_page(window: &adw::ApplicationWindow, content_stack: &gtk::Stack)
.build();
let install_media_button_content_text = gtk::Label::builder()
.label("Install Distro to System")
.label(gettext("install_distro_to_system"))
.margin_top(0)
.margin_bottom(15)
.margin_start(15)
@ -160,7 +160,7 @@ pub fn welcome_page(window: &adw::ApplicationWindow, content_stack: &gtk::Stack)
// / Content stack appends
//// Add the welcome_main_box as page: welcome_page, Give it nice title
content_stack.add_titled(&welcome_main_box, Some("welcome_page"), "Welcome");
content_stack.add_titled(&welcome_main_box, Some("welcome_page"), &gettext("welcome"));
install_media_button.connect_clicked(clone!(@weak content_stack => move |_| content_stack.set_visible_child_name("language_page")));
live_media_button.connect_clicked(clone!(@weak window => move |_| window.close()));