translation

This commit is contained in:
Ward from fusion-voyager-3 2024-06-22 01:06:44 +03:00
parent 43fef2198a
commit 63eda09368
4 changed files with 60 additions and 34 deletions

View File

@ -20,5 +20,29 @@
"disabled": "Disabled", "disabled": "Disabled",
"get_current_scheduler_sched_ext_detected": "sched_ext is detected, getting scx scheduler", "get_current_scheduler_sched_ext_detected": "sched_ext is detected, getting scx scheduler",
"kernel_badge_branch_label": "Kernel Branch", "kernel_badge_branch_label": "Kernel Branch",
"kernel_badge_branch_label": "Latest Version" "kernel_badge_latest_version_label": "Latest Version",
"kernel_badge_running_version_label": "Running Version",
"kernel_badge_running_kernel_label": "Running Kernel",
"kernel_badge_running_sched_label": "Running Sched",
"kernel_main_label_label": "Available Kernel Packages for",
"kernel_status_icon_tooltip_text": "Installed",
"kernel_install_button_label": "Install",
"kernel_install_button_tooltip_text": "Install this kernel",
"kernel_uninstall_button_label": "Uninstall",
"kernel_uninstall_button_tooltip_text": "Uninstall this kernel",
"kernel_install_dialog_heading": "Installing Kernel",
"kernel_install_dialog_ok_label": "OK",
"kernel_install_dialog_reboot_label": "Reboot Now (Optional)",
"kernel_install_dialog_body_successful": "Kernel installation was successful!",
"kernel_install_dialog_body_failed": "Kernel installation failed!",
"log_status_kernel_modify_successful": "Status: kernel modify Successful",
"log_status_kernel_modify_failed": "Status: kernel modify Failed",
"scx_sched_expander_row_subtitle": "Select Sched-EXT SCX Scheduler",
"sched_ext_main_label_label": "Sched-EXT Configuration Settings",
"sched_ext_apply_button_label": "Apply",
"sched_ext_cmd_status_dialog_heading_success": "Success!",
"sched_ext_cmd_status_dialog_body_success": "SCX has been set to",
"sched_ext_cmd_status_dialog_heading_failed": "Failed!",
"sched_ext_cmd_status_dialog_body_failed": "SCX couldn't be has been set to",
"sched_ext_null_checkbutton_label": "No Scheduler selected"
} }

View File

@ -272,7 +272,7 @@ fn kernel_branch_expandable(
} }
} }
_ => { _ => {
window_banner.set_title(t!("banner_text_url_error")); window_banner.set_title(&t!("banner_text_url_error").to_string());
window_banner.set_revealed(true); window_banner.set_revealed(true);
loading_box.set_visible(false); loading_box.set_visible(false);
} }
@ -517,7 +517,7 @@ fn create_kernel_badges(
&kernel_badges_size_group1, &kernel_badges_size_group1,
)); ));
badge_box.append(&create_kernel_badge( badge_box.append(&create_kernel_badge(
"Latest Version", &t!("kernel_badge_latest_version_label").to_string(),
kernel_version, kernel_version,
"background-accent-bg", "background-accent-bg",
&kernel_badges_size_group, &kernel_badges_size_group,
@ -525,7 +525,7 @@ fn create_kernel_badges(
&kernel_badges_size_group1, &kernel_badges_size_group1,
)); ));
badge_box.append(&create_kernel_badge( badge_box.append(&create_kernel_badge(
"Running Version", &t!("kernel_badge_running_version_label").to_string(),
&running_kernel_info.version, &running_kernel_info.version,
&version_css_style, &version_css_style,
&kernel_badges_size_group, &kernel_badges_size_group,
@ -533,7 +533,7 @@ fn create_kernel_badges(
&kernel_badges_size_group1, &kernel_badges_size_group1,
)); ));
badge_box.append(&create_kernel_badge( badge_box.append(&create_kernel_badge(
"Running Kernel", &t!("kernel_badge_running_kernel_label").to_string(),
&running_kernel_info.kernel, &running_kernel_info.kernel,
&version_css_style, &version_css_style,
&kernel_badges_size_group, &kernel_badges_size_group,
@ -541,7 +541,7 @@ fn create_kernel_badges(
&kernel_badges_size_group1, &kernel_badges_size_group1,
)); ));
badge_box.append(&create_kernel_badge( badge_box.append(&create_kernel_badge(
"Running Sched", &t!("kernel_badge_running_sched_label").to_string(),
&running_kernel_info.sched, &running_kernel_info.sched,
"background-accent-bg", "background-accent-bg",
&kernel_badges_size_group, &kernel_badges_size_group,

View File

@ -31,10 +31,11 @@ pub fn kernel_pkg_page(
let main_label = gtk::Label::builder() let main_label = gtk::Label::builder()
.label(format!( .label(format!(
"Available Kernel Packages for {}", "{} {}", t!("kernel_main_label_label"),
&selected_kernel_branch_clone0.name &selected_kernel_branch_clone0.name
)) ))
.hexpand(true) .hexpand(true)
.halign(Align::Center)
.margin_start(10) .margin_start(10)
.margin_end(10) .margin_end(10)
.margin_bottom(20) .margin_bottom(20)
@ -219,7 +220,7 @@ fn add_package_rows(
.pixel_size(24) .pixel_size(24)
.valign(Align::Center) .valign(Align::Center)
.visible(false) .visible(false)
.tooltip_text("Installed") .tooltip_text(t!("Installed"))
.build(); .build();
let kernel_description_label = gtk::Label::builder() let kernel_description_label = gtk::Label::builder()
.label(&kernel_description) .label(&kernel_description)
@ -231,8 +232,8 @@ fn add_package_rows(
.margin_top(5) .margin_top(5)
.margin_bottom(5) .margin_bottom(5)
.valign(gtk::Align::Center) .valign(gtk::Align::Center)
.label("Install") .label(t!("kernel_install_button_label"))
.tooltip_text("Install this kernel") .tooltip_text(t!("kernel_install_button_tooltip_text"))
.sensitive(false) .sensitive(false)
.build(); .build();
kernel_install_button.add_css_class("suggested-action"); kernel_install_button.add_css_class("suggested-action");
@ -241,8 +242,8 @@ fn add_package_rows(
.margin_top(5) .margin_top(5)
.margin_bottom(5) .margin_bottom(5)
.valign(gtk::Align::Center) .valign(gtk::Align::Center)
.label("Uninstall") .label(t!("kernel_uninstall_button_label"))
.tooltip_text("Uninstall this kernel") .tooltip_text(t!("kernel_uninstall_button_tooltip_text"))
.sensitive(false) .sensitive(false)
.build(); .build();
let kernel_action_box = gtk::Box::builder().homogeneous(true).build(); let kernel_action_box = gtk::Box::builder().homogeneous(true).build();
@ -296,11 +297,11 @@ fn add_package_rows(
.extra_child(&kernel_install_log_terminal_scroll) .extra_child(&kernel_install_log_terminal_scroll)
.width_request(400) .width_request(400)
.height_request(200) .height_request(200)
.heading("Installing Kernel") .heading(t!("kernel_install_dialog_heading"))
.build(); .build();
kernel_install_dialog.add_response("kernel_install_dialog_ok", "OK"); kernel_install_dialog.add_response("kernel_install_dialog_ok", &t!("kernel_install_dialog_ok_label").to_string());
kernel_install_dialog kernel_install_dialog
.add_response("kernel_install_dialog_reboot", "Reboot Now (Optional)"); .add_response("kernel_install_dialog_reboot", &t!("kernel_install_dialog_reboot_label").to_string());
kernel_install_dialog.set_response_appearance( kernel_install_dialog.set_response_appearance(
"kernel_install_dialog_reboot", "kernel_install_dialog_reboot",
adw::ResponseAppearance::Suggested, adw::ResponseAppearance::Suggested,
@ -328,10 +329,10 @@ fn add_package_rows(
// kernel_install_dialog.set_response_enabled("kernel_install_dialog_reboot", true); // kernel_install_dialog.set_response_enabled("kernel_install_dialog_reboot", true);
//} //}
kernel_install_dialog.set_response_enabled("kernel_install_dialog_reboot", true); kernel_install_dialog.set_response_enabled("kernel_install_dialog_reboot", true);
kernel_install_dialog.set_body("Kernel installation was successful!"); kernel_install_dialog.set_body(&t!("kernel_install_dialog_body_successful").to_string());
} else { } else {
kernel_install_dialog.set_response_enabled("kernel_install_dialog_ok", true); kernel_install_dialog.set_response_enabled("kernel_install_dialog_ok", true);
kernel_install_dialog.set_body("Kernel Installation Failed!"); kernel_install_dialog.set_body(&t!("kernel_install_dialog_body_failed").to_string());
kernel_install_dialog.set_response_enabled("kernel_install_dialog_reboot", false); kernel_install_dialog.set_response_enabled("kernel_install_dialog_reboot", false);
} }
} }
@ -363,11 +364,11 @@ fn add_package_rows(
let command = kernel_modify(log_loop_sender_clone, &kernel_packages_clone); let command = kernel_modify(log_loop_sender_clone, &kernel_packages_clone);
match command { match command {
Ok(_) => { Ok(_) => {
println!("Status: kernel modify Successful"); println!("{}", t!("log_status_kernel_modify_successful"));
log_status_loop_sender_clone.send_blocking(true).expect("The channel needs to be open."); log_status_loop_sender_clone.send_blocking(true).expect("The channel needs to be open.");
} }
Err(_) => { Err(_) => {
println!("Status: kernel modify Failed"); println!("{}", t!("log_status_kernel_modify_failed"));
log_status_loop_sender_clone.send_blocking(false).expect("The channel needs to be open."); log_status_loop_sender_clone.send_blocking(false).expect("The channel needs to be open.");
} }
} }
@ -393,11 +394,11 @@ fn add_package_rows(
let command = kernel_modify(log_loop_sender_clone, &kernel_packages_clone); let command = kernel_modify(log_loop_sender_clone, &kernel_packages_clone);
match command { match command {
Ok(_) => { Ok(_) => {
println!("Status: kernel modify Successful"); println!("{}", t!("log_status_kernel_modify_successful"));
log_status_loop_sender_clone.send_blocking(true).expect("The channel needs to be open."); log_status_loop_sender_clone.send_blocking(true).expect("The channel needs to be open.");
} }
Err(_) => { Err(_) => {
println!("Status: kernel modify Failed"); println!("{}", t!("log_status_kernel_modify_failed"));
log_status_loop_sender_clone.send_blocking(false).expect("The channel needs to be open."); log_status_loop_sender_clone.send_blocking(false).expect("The channel needs to be open.");
} }
} }
@ -457,10 +458,11 @@ fn kernel_modify(
fn get_cpu_feature_level() -> String { fn get_cpu_feature_level() -> String {
let base_command = Command::new("/lib64/ld-linux-x86-64.so.2") // `ps` command... let base_command = Command::new("/lib64/ld-linux-x86-64.so.2") // `ps` command...
.arg("--help") // with argument `axww`... .arg("--help")
.stdout(Stdio::piped()) // of which we will pipe the output. .env("LANG" ,"en_US")
.spawn() // Once configured, we actually spawn the command... .stdout(Stdio::piped())
.unwrap(); // and assert everything went right. .spawn()
.unwrap();
let grep_command = Command::new("grep") let grep_command = Command::new("grep")
.arg("(supported, searched)") .arg("(supported, searched)")
.stdin(Stdio::from(base_command.stdout.unwrap())) .stdin(Stdio::from(base_command.stdout.unwrap()))

View File

@ -39,7 +39,7 @@ pub fn sched_ext_page(content_stack: &gtk::Stack, window: &adw::ApplicationWindo
main_icon.add_css_class("symbolic-accent-bg"); main_icon.add_css_class("symbolic-accent-bg");
let main_label = gtk::Label::builder() let main_label = gtk::Label::builder()
.label("Sched-EXT Configuration Settings") .label(t!("sched_ext_main_label_label"))
.hexpand(true) .hexpand(true)
.margin_start(10) .margin_start(10)
.margin_end(10) .margin_end(10)
@ -73,7 +73,7 @@ pub fn sched_ext_page(content_stack: &gtk::Stack, window: &adw::ApplicationWindo
cmd_status_dialog.add_response("cmd_status_dialog_ok", "Ok"); cmd_status_dialog.add_response("cmd_status_dialog_ok", "Ok");
let scx_sched_expander_row = adw::ExpanderRow::builder() let scx_sched_expander_row = adw::ExpanderRow::builder()
.subtitle("Select Sched-EXT Scheduler") .subtitle(t!("scx_sched_expander_row_subtitle"))
.build(); .build();
scx_sched_expander_row.add_row(&scx_sched_expandable( scx_sched_expander_row.add_row(&scx_sched_expandable(
@ -121,7 +121,7 @@ pub fn sched_ext_page(content_stack: &gtk::Stack, window: &adw::ApplicationWindo
let apply_button = gtk::Button::builder() let apply_button = gtk::Button::builder()
.halign(Align::End) .halign(Align::End)
.label("Apply Changes") .label(t!("sched_ext_apply_button_label"))
.sensitive(false) .sensitive(false)
.build(); .build();
@ -137,8 +137,8 @@ pub fn sched_ext_page(content_stack: &gtk::Stack, window: &adw::ApplicationWindo
&kernel_badges_size_group0, &kernel_badges_size_group0,
&kernel_badges_size_group1,) { &kernel_badges_size_group1,) {
Ok(_) => { Ok(_) => {
cmd_status_dialog.set_heading(Some("Success!")); cmd_status_dialog.set_heading(Some(&t!("sched_ext_cmd_status_dialog_heading_success").to_string()));
cmd_status_dialog.set_body(format!("SCX has been set to: {}", &selected_scx_sched_clone1).as_str()); cmd_status_dialog.set_body(format!("{}: {}", t!("sched_ext_cmd_status_dialog_body_success"), &selected_scx_sched_clone1).as_str());
cmd_status_dialog.present(); cmd_status_dialog.present();
create_current_sched_badge( create_current_sched_badge(
&badge_box, &badge_box,
@ -149,8 +149,8 @@ pub fn sched_ext_page(content_stack: &gtk::Stack, window: &adw::ApplicationWindo
); );
} }
Err(_) => { Err(_) => {
cmd_status_dialog.set_heading(Some("Failed!")); cmd_status_dialog.set_heading(Some(&t!("sched_ext_cmd_status_dialog_heading_failed").to_string()));
cmd_status_dialog.set_body(format!("SCX couldn't be has been set to: {}", &selected_scx_sched_clone1).as_str()); cmd_status_dialog.set_body(format!("{}: {}", t!("sched_ext_cmd_status_dialog_body_failed"), &selected_scx_sched_clone1).as_str());
cmd_status_dialog.present(); cmd_status_dialog.present();
create_current_sched_badge( create_current_sched_badge(
&badge_box, &badge_box,
@ -209,7 +209,7 @@ fn create_current_sched_badge(
} }
badge_box.append(&crate::content::create_kernel_badge( badge_box.append(&crate::content::create_kernel_badge(
"Running Sched", &t!("kernel_badge_running_sched_label").to_string(),
&running_kernel_info.sched, &running_kernel_info.sched,
"background-accent-bg", "background-accent-bg",
&kernel_badges_size_group, &kernel_badges_size_group,
@ -237,7 +237,7 @@ fn scx_sched_expandable(
sched_container.add_css_class("boxed-list"); sched_container.add_css_class("boxed-list");
let null_checkbutton = gtk::CheckButton::builder() let null_checkbutton = gtk::CheckButton::builder()
.label("No branch selected") .label(t!("sched_ext_null_checkbutton_label"))
.build(); .build();
let data = fs::read_to_string("/usr/lib/fedora-kernel-manager/scx_scheds.json") let data = fs::read_to_string("/usr/lib/fedora-kernel-manager/scx_scheds.json")