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",
"get_current_scheduler_sched_ext_detected": "sched_ext is detected, getting scx scheduler",
"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);
loading_box.set_visible(false);
}
@ -517,7 +517,7 @@ fn create_kernel_badges(
&kernel_badges_size_group1,
));
badge_box.append(&create_kernel_badge(
"Latest Version",
&t!("kernel_badge_latest_version_label").to_string(),
kernel_version,
"background-accent-bg",
&kernel_badges_size_group,
@ -525,7 +525,7 @@ fn create_kernel_badges(
&kernel_badges_size_group1,
));
badge_box.append(&create_kernel_badge(
"Running Version",
&t!("kernel_badge_running_version_label").to_string(),
&running_kernel_info.version,
&version_css_style,
&kernel_badges_size_group,
@ -533,7 +533,7 @@ fn create_kernel_badges(
&kernel_badges_size_group1,
));
badge_box.append(&create_kernel_badge(
"Running Kernel",
&t!("kernel_badge_running_kernel_label").to_string(),
&running_kernel_info.kernel,
&version_css_style,
&kernel_badges_size_group,
@ -541,7 +541,7 @@ fn create_kernel_badges(
&kernel_badges_size_group1,
));
badge_box.append(&create_kernel_badge(
"Running Sched",
&t!("kernel_badge_running_sched_label").to_string(),
&running_kernel_info.sched,
"background-accent-bg",
&kernel_badges_size_group,

View File

@ -31,10 +31,11 @@ pub fn kernel_pkg_page(
let main_label = gtk::Label::builder()
.label(format!(
"Available Kernel Packages for {}",
"{} {}", t!("kernel_main_label_label"),
&selected_kernel_branch_clone0.name
))
.hexpand(true)
.halign(Align::Center)
.margin_start(10)
.margin_end(10)
.margin_bottom(20)
@ -219,7 +220,7 @@ fn add_package_rows(
.pixel_size(24)
.valign(Align::Center)
.visible(false)
.tooltip_text("Installed")
.tooltip_text(t!("Installed"))
.build();
let kernel_description_label = gtk::Label::builder()
.label(&kernel_description)
@ -231,8 +232,8 @@ fn add_package_rows(
.margin_top(5)
.margin_bottom(5)
.valign(gtk::Align::Center)
.label("Install")
.tooltip_text("Install this kernel")
.label(t!("kernel_install_button_label"))
.tooltip_text(t!("kernel_install_button_tooltip_text"))
.sensitive(false)
.build();
kernel_install_button.add_css_class("suggested-action");
@ -241,8 +242,8 @@ fn add_package_rows(
.margin_top(5)
.margin_bottom(5)
.valign(gtk::Align::Center)
.label("Uninstall")
.tooltip_text("Uninstall this kernel")
.label(t!("kernel_uninstall_button_label"))
.tooltip_text(t!("kernel_uninstall_button_tooltip_text"))
.sensitive(false)
.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)
.width_request(400)
.height_request(200)
.heading("Installing Kernel")
.heading(t!("kernel_install_dialog_heading"))
.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
.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_reboot",
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_body("Kernel installation was successful!");
kernel_install_dialog.set_body(&t!("kernel_install_dialog_body_successful").to_string());
} else {
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);
}
}
@ -363,11 +364,11 @@ fn add_package_rows(
let command = kernel_modify(log_loop_sender_clone, &kernel_packages_clone);
match command {
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.");
}
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.");
}
}
@ -393,11 +394,11 @@ fn add_package_rows(
let command = kernel_modify(log_loop_sender_clone, &kernel_packages_clone);
match command {
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.");
}
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.");
}
}
@ -457,10 +458,11 @@ fn kernel_modify(
fn get_cpu_feature_level() -> String {
let base_command = Command::new("/lib64/ld-linux-x86-64.so.2") // `ps` command...
.arg("--help") // with argument `axww`...
.stdout(Stdio::piped()) // of which we will pipe the output.
.spawn() // Once configured, we actually spawn the command...
.unwrap(); // and assert everything went right.
.arg("--help")
.env("LANG" ,"en_US")
.stdout(Stdio::piped())
.spawn()
.unwrap();
let grep_command = Command::new("grep")
.arg("(supported, searched)")
.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");
let main_label = gtk::Label::builder()
.label("Sched-EXT Configuration Settings")
.label(t!("sched_ext_main_label_label"))
.hexpand(true)
.margin_start(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");
let scx_sched_expander_row = adw::ExpanderRow::builder()
.subtitle("Select Sched-EXT Scheduler")
.subtitle(t!("scx_sched_expander_row_subtitle"))
.build();
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()
.halign(Align::End)
.label("Apply Changes")
.label(t!("sched_ext_apply_button_label"))
.sensitive(false)
.build();
@ -137,8 +137,8 @@ pub fn sched_ext_page(content_stack: &gtk::Stack, window: &adw::ApplicationWindo
&kernel_badges_size_group0,
&kernel_badges_size_group1,) {
Ok(_) => {
cmd_status_dialog.set_heading(Some("Success!"));
cmd_status_dialog.set_body(format!("SCX has been set to: {}", &selected_scx_sched_clone1).as_str());
cmd_status_dialog.set_heading(Some(&t!("sched_ext_cmd_status_dialog_heading_success").to_string()));
cmd_status_dialog.set_body(format!("{}: {}", t!("sched_ext_cmd_status_dialog_body_success"), &selected_scx_sched_clone1).as_str());
cmd_status_dialog.present();
create_current_sched_badge(
&badge_box,
@ -149,8 +149,8 @@ pub fn sched_ext_page(content_stack: &gtk::Stack, window: &adw::ApplicationWindo
);
}
Err(_) => {
cmd_status_dialog.set_heading(Some("Failed!"));
cmd_status_dialog.set_body(format!("SCX couldn't be has been set to: {}", &selected_scx_sched_clone1).as_str());
cmd_status_dialog.set_heading(Some(&t!("sched_ext_cmd_status_dialog_heading_failed").to_string()));
cmd_status_dialog.set_body(format!("{}: {}", t!("sched_ext_cmd_status_dialog_body_failed"), &selected_scx_sched_clone1).as_str());
cmd_status_dialog.present();
create_current_sched_badge(
&badge_box,
@ -209,7 +209,7 @@ fn create_current_sched_badge(
}
badge_box.append(&crate::content::create_kernel_badge(
"Running Sched",
&t!("kernel_badge_running_sched_label").to_string(),
&running_kernel_info.sched,
"background-accent-bg",
&kernel_badges_size_group,
@ -237,7 +237,7 @@ fn scx_sched_expandable(
sched_container.add_css_class("boxed-list");
let null_checkbutton = gtk::CheckButton::builder()
.label("No branch selected")
.label(t!("sched_ext_null_checkbutton_label"))
.build();
let data = fs::read_to_string("/usr/lib/fedora-kernel-manager/scx_scheds.json")