From 3f6b72c977b65b1e1735f4f7ecdeea9f633d38a6 Mon Sep 17 00:00:00 2001 From: ochibani <11yzyv86j@relay.firefox.com> Date: Mon, 3 Jun 2024 21:34:16 +0200 Subject: [PATCH] update fluent --- Cargo.lock | 61 +++++++++++++--------- Cargo.toml | 3 +- interfaces/main.ui | 34 ++++++------- locales/ar_YE.ftl | 87 ++++++++++++++++++++++++++++++++ locales/{en-US.ftl => en_US.ftl} | 22 ++++++-- src/main.rs | 62 +++++++++++++++++------ src/timer.rs | 4 +- 7 files changed, 207 insertions(+), 66 deletions(-) create mode 100644 locales/ar_YE.ftl rename locales/{en-US.ftl => en_US.ftl} (83%) diff --git a/Cargo.lock b/Cargo.lock index 5d9aaa5..c030668 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -71,9 +71,9 @@ dependencies = [ [[package]] name = "async-broadcast" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258b52a1aa741b9f09783b2d86cf0aeeb617bbf847f6933340a39644227acbdb" +checksum = "20cd0e2e25ea8e5f7e9df04578dc6cf5c83577fd09b1a46aaf5c85e1c33f2a7e" dependencies = [ "event-listener 5.3.1", "event-listener-strategy", @@ -391,6 +391,7 @@ dependencies = [ "dark-light", "dirs", "filename", + "fluent", "fluent-bundle", "gdk-pixbuf 0.9.0", "gdk4 0.9.0", @@ -435,7 +436,7 @@ dependencies = [ [[package]] name = "cairo-rs" version = "0.20.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#6c6c7bd561b9c66dceb4103f80bb21cd33be8563" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#bfbba2af8d2c1f09134919d378ea833caff32b4b" dependencies = [ "bitflags 2.5.0", "cairo-sys-rs 0.20.0", @@ -458,7 +459,7 @@ dependencies = [ [[package]] name = "cairo-sys-rs" version = "0.20.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#6c6c7bd561b9c66dceb4103f80bb21cd33be8563" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#bfbba2af8d2c1f09134919d378ea833caff32b4b" dependencies = [ "glib-sys 0.20.0", "libc", @@ -770,6 +771,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "fluent" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb74634707bebd0ce645a981148e8fb8c7bccd4c33c652aeffd28bf2f96d555a" +dependencies = [ + "fluent-bundle", + "unic-langid", +] + [[package]] name = "fluent-bundle" version = "0.15.3" @@ -952,7 +963,7 @@ dependencies = [ [[package]] name = "gdk-pixbuf" version = "0.20.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#6c6c7bd561b9c66dceb4103f80bb21cd33be8563" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#bfbba2af8d2c1f09134919d378ea833caff32b4b" dependencies = [ "gdk-pixbuf-sys 0.20.0", "gio 0.20.0", @@ -989,7 +1000,7 @@ dependencies = [ [[package]] name = "gdk-pixbuf-sys" version = "0.20.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#6c6c7bd561b9c66dceb4103f80bb21cd33be8563" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#bfbba2af8d2c1f09134919d378ea833caff32b4b" dependencies = [ "gio-sys 0.20.0", "glib-sys 0.20.0", @@ -1034,7 +1045,7 @@ dependencies = [ [[package]] name = "gdk4" version = "0.9.0" -source = "git+https://github.com/gtk-rs/gtk4-rs.git#3826b9acf320beedc3a1b0a326501e8ebadc05e6" +source = "git+https://github.com/gtk-rs/gtk4-rs.git#32e7155cd32bd5c27e1847c7e38aae825642043a" dependencies = [ "cairo-rs 0.20.0", "gdk-pixbuf 0.20.0", @@ -1065,7 +1076,7 @@ dependencies = [ [[package]] name = "gdk4-sys" version = "0.9.0" -source = "git+https://github.com/gtk-rs/gtk4-rs.git#3826b9acf320beedc3a1b0a326501e8ebadc05e6" +source = "git+https://github.com/gtk-rs/gtk4-rs.git#32e7155cd32bd5c27e1847c7e38aae825642043a" dependencies = [ "cairo-sys-rs 0.20.0", "gdk-pixbuf-sys 0.20.0", @@ -1140,7 +1151,7 @@ dependencies = [ [[package]] name = "gio" version = "0.20.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#6c6c7bd561b9c66dceb4103f80bb21cd33be8563" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#bfbba2af8d2c1f09134919d378ea833caff32b4b" dependencies = [ "futures-channel", "futures-core", @@ -1196,7 +1207,7 @@ dependencies = [ [[package]] name = "gio-sys" version = "0.20.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#6c6c7bd561b9c66dceb4103f80bb21cd33be8563" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#bfbba2af8d2c1f09134919d378ea833caff32b4b" dependencies = [ "glib-sys 0.20.0", "gobject-sys 0.20.0", @@ -1270,7 +1281,7 @@ dependencies = [ [[package]] name = "glib" version = "0.20.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#6c6c7bd561b9c66dceb4103f80bb21cd33be8563" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#bfbba2af8d2c1f09134919d378ea833caff32b4b" dependencies = [ "bitflags 2.5.0", "futures-channel", @@ -1337,7 +1348,7 @@ dependencies = [ [[package]] name = "glib-macros" version = "0.20.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#6c6c7bd561b9c66dceb4103f80bb21cd33be8563" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#bfbba2af8d2c1f09134919d378ea833caff32b4b" dependencies = [ "heck 0.5.0", "proc-macro-crate 3.1.0", @@ -1379,7 +1390,7 @@ dependencies = [ [[package]] name = "glib-sys" version = "0.20.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#6c6c7bd561b9c66dceb4103f80bb21cd33be8563" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#bfbba2af8d2c1f09134919d378ea833caff32b4b" dependencies = [ "libc", "system-deps 6.2.2", @@ -1433,7 +1444,7 @@ dependencies = [ [[package]] name = "gobject-sys" version = "0.20.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#6c6c7bd561b9c66dceb4103f80bb21cd33be8563" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#bfbba2af8d2c1f09134919d378ea833caff32b4b" dependencies = [ "glib-sys 0.20.0", "libc", @@ -1962,7 +1973,7 @@ dependencies = [ [[package]] name = "pango" version = "0.20.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#6c6c7bd561b9c66dceb4103f80bb21cd33be8563" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#bfbba2af8d2c1f09134919d378ea833caff32b4b" dependencies = [ "gio 0.20.0", "glib 0.20.0", @@ -1985,7 +1996,7 @@ dependencies = [ [[package]] name = "pango-sys" version = "0.20.0" -source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#6c6c7bd561b9c66dceb4103f80bb21cd33be8563" +source = "git+https://github.com/gtk-rs/gtk-rs-core?branch=master#bfbba2af8d2c1f09134919d378ea833caff32b4b" dependencies = [ "glib-sys 0.20.0", "gobject-sys 0.20.0", @@ -2131,9 +2142,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.84" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec96c6a92621310b51366f1e28d05ef11489516e93be030060e5fc12024a49d6" +checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" dependencies = [ "unicode-ident", ] @@ -2480,7 +2491,7 @@ dependencies = [ "cfg-expr", "heck 0.5.0", "pkg-config", - "toml 0.8.13", + "toml 0.8.14", "version-compare 0.2.0", ] @@ -2542,14 +2553,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.13" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba" +checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.13", + "toml_edit 0.22.14", ] [[package]] @@ -2585,9 +2596,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.13" +version = "0.22.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c" +checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38" dependencies = [ "indexmap", "serde", @@ -3049,7 +3060,7 @@ version = "4.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "989c3977a7aafa97b12b9a35d21cdcff9b0d2289762b14683f45d66b1ba6c48f" dependencies = [ - "async-broadcast 0.7.0", + "async-broadcast 0.7.1", "async-executor", "async-fs 2.1.2", "async-io 2.3.3", diff --git a/Cargo.toml b/Cargo.toml index a665a54..e5be407 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ async-std = {version = "1.12.0", features = ["attributes"]} chrono = "0.4.19" dark-light = "1.0.0" dirs = "4.0.0" +fluent = "0.16.1" fluent-bundle = "0.15.3" filename = "0.1.1" gdk = { git = "https://github.com/gtk-rs/gtk4-rs.git", package = "gdk4"} @@ -17,7 +18,7 @@ gdk-pixbuf = "0.9.0" gio = { version = "0.15.0" } glib = "0.10.3" gstreamer = "0.20.5" -gtk = { version = "0.4.8", package = "gtk4", features = ["v4_8"] } +gtk = { version = "0.4.6", package = "gtk4", features = ["v4_6"] } gtk-sys = "0.15" regex = "1.4.3" rust-ini = "0.16" diff --git a/interfaces/main.ui b/interfaces/main.ui index 2eb86c0..f035192 100644 --- a/interfaces/main.ui +++ b/interfaces/main.ui @@ -68,10 +68,10 @@ - + True True - Apply + label @@ -98,7 +98,7 @@ delay_window_title True - Start Recording in… + label 10 @@ -108,6 +108,7 @@ True True True + label @@ -119,7 +120,7 @@ 10 10 10 - Stop + label @@ -239,8 +240,8 @@ - - Select an Area + + label True True @@ -274,8 +275,8 @@ - - Select Screen + + label True True @@ -308,8 +309,8 @@ - - Select a Window + + label True True @@ -424,9 +425,8 @@ True True 2 - 60 + number adjustment2 - 60 @@ -446,7 +446,7 @@ True True 2 - 0 + number adjustment1 1 @@ -562,10 +562,10 @@ - + True True - Record + label @@ -592,10 +592,10 @@ - + True True - Stop Recording + label diff --git a/locales/ar_YE.ftl b/locales/ar_YE.ftl new file mode 100644 index 0000000..f5708f0 --- /dev/null +++ b/locales/ar_YE.ftl @@ -0,0 +1,87 @@ +blue-recorder = المسجّل الأزرق + +area-chooser = محدد المنطقة + +wayland-msg = غير مدعوم في وايلاند + +default-command = تشغيل أمر عند الانتهاء: + +file-name = اسم الملفّ الافتراضي: + +mp4-format = MP4 (MPEG-4 Part 14) + +mkv-format = MKV (Matroska multimedia container format) + +webm-format = WEBM (Open Web Media File) + +gif-format = GIF (Graphics Interchange Format) + +avi-format = AVI (Audio Video Interleaved) + +wmv-format = WMV (Windows Media Video) + +nut-format = NUT (NUT Recording Format) + +audio-input = مصدر صوت PulseAudio الافتراضي + +record-video = تسجيل الصوت + +record-audio = تسجيل الصوت + +show-mouse = إظهار الفأرة + +follow-mouse = متابعة الفأرة + +auto-hide = إخفاء تلقائي + +run-command = تشغيل أمر عند الانتهاء: + +frames = الإطارات: + +delay = التأخير: + +audio-source = مدخل الصوت: + +about = عن البرنامج + +dialog-comment = مسجّل شاشة بسيط لسطح مكتب لينكس، يدعم إكس ووايلاند. + +translator-credits = translator-credits + +already-exist = File already exist. Do you want to overwrite it? + +blue-recorder-preferences = Blue Recorder Preferences + +file-name-overwritten = File Name (Will be overwritten).. + +enter-command = Enter your command here.. + +select-window = Select a Window + +delay-window-label = valuefsf + +default-frames = {$value} + +default-delay = {$value} + +default-folder = Default folder: + +default-pipeline = Default pipeline: + +record-mouse = Record Mouse + +record = سجل + +delay-title = Start Recording in… + +position-msg = Your area position has been saved! + +stop-recording = stop recording + +apply = تطبيق + +select-area = اختار مساحة + +select-screen = ختار شاشة + +delay-window-stop = Stop diff --git a/locales/en-US.ftl b/locales/en_US.ftl similarity index 83% rename from locales/en-US.ftl rename to locales/en_US.ftl index a9082b4..457ae48 100644 --- a/locales/en-US.ftl +++ b/locales/en_US.ftl @@ -42,7 +42,9 @@ delay = Delay: audio-source = Audio Input Source: -about = about +about = About + +apply = Apply dialog-comment = A simple screen recorder for Linux desktop. Supports Wayland & Xorg. @@ -50,6 +52,16 @@ translator-credits = translator-credits already-exist = File already exist. Do you want to overwrite it? +record = Record + +delay-title = Start Recording in… + +delay-window-label = {$value} + +delay-window-stop = Stop + +stop-recording = Stop recording + blue-recorder-preferences = Blue Recorder Preferences file-name-overwritten = File Name (Will be overwritten).. @@ -60,9 +72,11 @@ select-window = Select a Window select-area = Select an Area -default-frames = Default frames: +select-screen = Select a Screen -default-delay = Default delay: +default-frames = {$value} + +default-delay = {$value} default-folder = Default folder: @@ -71,5 +85,3 @@ default-pipeline = Default pipeline: record-mouse = Record Mouse position-msg = Your area position has been saved! - -stop-recording = stop recording diff --git a/src/main.rs b/src/main.rs index 9dc640d..0974ccf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,7 +10,7 @@ mod utils; use ffmpeg_interface::Ffmpeg; use fluent_bundle::bundle::FluentBundle; -use fluent_bundle::FluentResource; +use fluent_bundle::{FluentArgs, FluentResource}; use gtk::glib; use gtk::prelude::*; use gtk::{ @@ -59,9 +59,9 @@ pub fn build_ui(application: &Application) { let path = entry.unwrap().path(); path.file_stem().unwrap().to_string_lossy().to_string() }).collect(); - let mut locale = std::env::var("LANG").unwrap_or("en-US".to_string()); + let mut locale = std::env::var("LANG").unwrap_or("en_US".to_string()); if !supported_lang.contains(&locale) { - locale = String::from("en-US"); + locale = String::from("en_US"); } let ftl_file = std::fs::read_to_string( format!("{}/{}.ftl", ftl_path.to_str().unwrap(),locale.split('.').next().unwrap()) @@ -75,9 +75,11 @@ pub fn build_ui(application: &Application) { // Get Objects from UI let main_window: Window = builder.object("main_window").unwrap(); + let area_apply_label: Label = builder.object("area_apply").unwrap(); let area_chooser_window: Window = builder.object("area_chooser_window").unwrap(); let area_grab_button: ToggleButton = builder.object("area_grab_button").unwrap(); let area_grab_icon: Image = builder.object("area_grab_icon").unwrap(); + let area_grab_label: Label = builder.object("area_grab_label").unwrap(); let area_set_button: Button = builder.object("area_set_button").unwrap(); let about_button: Button = builder.object("aboutbutton").unwrap(); let about_dialog: AboutDialog = builder.object("about_dialog").unwrap(); @@ -89,8 +91,9 @@ pub fn build_ui(application: &Application) { let delay_label: Label = builder.object("delay_label").unwrap(); let delay_spin: SpinButton = builder.object("delay").unwrap(); let delay_window: Window = builder.object("delay_window").unwrap(); - let delay_window_label: Label = builder.object("delay_window_label").unwrap(); let delay_window_button: ToggleButton = builder.object("delay_window_stopbutton").unwrap(); + let delay_window_label: Label = builder.object("delay_window_label").unwrap(); + let delay_window_title: Label = builder.object("delay_window_title").unwrap(); let filename_entry: Entry = builder.object("filename").unwrap(); let folder_chooser_button: Button = builder.object("folder_chooser").unwrap(); let folder_chooser_image: Image = builder.object("folder_chooser_image").unwrap(); @@ -103,13 +106,17 @@ pub fn build_ui(application: &Application) { let mouse_switch: CheckButton = builder.object("mouseswitch").unwrap(); let play_button: Button = builder.object("playbutton").unwrap(); let record_button: Button = builder.object("recordbutton").unwrap(); + let record_label: Label = builder.object("record_label").unwrap(); let record_time_label: Label = builder.object("record_time_label").unwrap(); let screen_grab_button: ToggleButton = builder.object("screen_grab_button").unwrap(); let screen_grab_icon: Image = builder.object("screen_grab_icon").unwrap(); + let screen_grab_label: Label = builder.object("screen_grab_label").unwrap(); let stop_button: Button = builder.object("stopbutton").unwrap(); + let stop_label: Label = builder.object("stop_label").unwrap(); let video_switch: CheckButton = builder.object("videoswitch").unwrap(); - let window_grab_icon: Image = builder.object("window_grab_icon").unwrap(); let window_grab_button: ToggleButton = builder.object("window_grab_button").unwrap(); + let window_grab_icon: Image = builder.object("window_grab_icon").unwrap(); + let window_grab_label: Label = builder.object("window_grab_label").unwrap(); // --- default properties // Windows @@ -369,15 +376,6 @@ pub fn build_ui(application: &Application) { window_grab_icon.set_from_file(Some(&window_icon_path)); } } - // Labels - command_label.set_label(&bundle.format_pattern(bundle.get_message("run-command").unwrap() - .value().unwrap(), None, &mut vec![]).to_string()); - frames_label.set_label(&bundle.format_pattern(bundle.get_message("frames").unwrap() - .value().unwrap(), None, &mut vec![]).to_string()); - delay_label.set_label(&bundle.format_pattern(bundle.get_message("delay").unwrap() - .value().unwrap(), None, &mut vec![]).to_string()); - audio_source_label.set_label(&bundle.format_pattern(bundle.get_message("audio-source").unwrap() - .value().unwrap(), None, &mut vec![]).to_string()); // Spin frames_spin.set_value( @@ -405,6 +403,24 @@ pub fn build_ui(application: &Application) { config_management::set("default", "delay", _delay_spin.value().to_string().as_str()); }); + // Labels + let mut frames_value = FluentArgs::new(); + frames_value.set("value", frames_spin.value()); + let mut delay_time_value = FluentArgs::new(); + delay_time_value.set("value", delay_spin.value()); + command_label.set_label(&bundle.format_pattern(bundle.get_message("run-command").unwrap() + .value().unwrap(), None, &mut vec![]).to_string()); + frames_label.set_label(&bundle.format_pattern(bundle.get_message("frames").unwrap() + .value().unwrap(), None, &mut vec![]).to_string()); + frames_spin.set_text(&bundle.format_pattern(bundle.get_message("default-frames").unwrap() + .value().unwrap(), Some(&frames_value), &mut vec![]).to_string()); + delay_label.set_label(&bundle.format_pattern(bundle.get_message("delay").unwrap() + .value().unwrap(), None, &mut vec![]).to_string()); + delay_spin.set_text(&bundle.format_pattern(bundle.get_message("default-delay").unwrap() + .value().unwrap(), Some(&delay_time_value), &mut vec![]).to_string()); + audio_source_label.set_label(&bundle.format_pattern(bundle.get_message("audio-source").unwrap() + .value().unwrap(), None, &mut vec![]).to_string()); + // FileChooser let folder_chooser_native = FileChooserNative::new( Some("Select Folder"), @@ -460,12 +476,16 @@ pub fn build_ui(application: &Application) { let _area_chooser_window = area_chooser_window.clone(); let mut _area_capture = area_capture.clone(); + area_grab_label.set_label(&bundle.format_pattern(bundle.get_message("select-area").unwrap() + .value().unwrap(), None, &mut vec![]).to_string()); area_grab_button.connect_clicked(move |_| { _area_chooser_window.show(); }); let _area_chooser_window = area_chooser_window.clone(); let mut _area_capture = area_capture.clone(); + area_apply_label.set_label(&bundle.format_pattern(bundle.get_message("apply").unwrap() + .value().unwrap(), None, &mut vec![]).to_string()); area_set_button.connect_clicked(move |_| { _area_chooser_window.hide(); }); @@ -475,7 +495,8 @@ pub fn build_ui(application: &Application) { let record_window: Rc> = Rc::new(RefCell::new(false)); let window_grab_button_record_window: Rc> = record_window.clone(); let screen_grab_button_record_window: Rc> = record_window.clone(); - + screen_grab_label.set_label(&bundle.format_pattern(bundle.get_message("select-screen").unwrap() + .value().unwrap(), None, &mut vec![]).to_string()); screen_grab_button.connect_clicked(move |_| { screen_grab_button_record_window.replace(false); _area_chooser_window.hide(); @@ -484,6 +505,8 @@ pub fn build_ui(application: &Application) { let _area_chooser_window: Window = area_chooser_window.clone(); let mut _area_capture: Rc> = area_capture.clone(); + window_grab_label.set_label(&bundle.format_pattern(bundle.get_message("select-window").unwrap() + .value().unwrap(), None, &mut vec![]).to_string()); window_grab_button.connect_clicked(move |_| { _area_chooser_window.hide(); if is_wayland() { @@ -535,7 +558,12 @@ pub fn build_ui(application: &Application) { let _record_button = record_button.clone(); let _record_time_label = record_time_label.clone(); let _stop_button = stop_button.clone(); - + record_label.set_label(&bundle.format_pattern(bundle.get_message("record").unwrap() + .value().unwrap(), None, &mut vec![]).to_string()); + delay_window_title.set_label(&bundle.format_pattern(bundle.get_message("delay-title").unwrap() + .value().unwrap(), None, &mut vec![]).to_string()); + delay_window_button.set_label(&bundle.format_pattern(bundle.get_message("delay-window-stop").unwrap() + .value().unwrap(), None, &mut vec![]).to_string()); record_button.connect_clicked(move |_| { _delay_window_button.set_active(false); if _delay_spin.value() as u64 > 0 { @@ -576,6 +604,8 @@ pub fn build_ui(application: &Application) { let mut _ffmpeg_record_interface = ffmpeg_record_interface.clone(); let _play_button = play_button.clone(); let _stop_button = stop_button.clone(); + stop_label.set_label(&bundle.format_pattern(bundle.get_message("stop-recording").unwrap() + .value().unwrap(), None, &mut vec![]).to_string()); stop_button.connect_clicked(move |_| { _record_time_label.set_visible(false); stop_timer(_record_time_label.clone()); diff --git a/src/timer.rs b/src/timer.rs index a0fa2a5..b244c49 100644 --- a/src/timer.rs +++ b/src/timer.rs @@ -4,7 +4,8 @@ use gtk::glib; use gtk::{Button, ToggleButton, Label, SpinButton, Window}; use gtk::prelude::*; -pub fn recording_delay(delay_spin: SpinButton, mut delay_time: u64, delay_window: Window, delay_window_button: ToggleButton, delay_window_label: Label, record_button: Button) { +pub fn recording_delay(delay_spin: SpinButton, mut delay_time: u64, delay_window: Window, + delay_window_button: ToggleButton, delay_window_label: Label, record_button: Button) { // Keep time label alive and update every 1sec let default_value = delay_time; let capture_delay_label = move || { @@ -53,7 +54,6 @@ pub fn stop_timer(record_time_label: Label) { record_time_label.set_text(¤t_record_time(stop_time)); } - fn current_delay_time(delay_time: u64) -> String { let delay = secfmt::from(delay_time); format!("{:02}:{:02}", delay.minutes, delay.seconds)