about summary refs log tree commit diff
path: root/src/ui/window.rs
diff options
context:
space:
mode:
authorlakoliu <99976966+lakoliu@users.noreply.github.com>2022-04-06 22:27:13 +0300
committerGitHub <noreply@github.com>2022-04-06 22:27:13 +0300
commit3070a42a39b45de78364c888cd28c84dca3ba7bb (patch)
treeeba0f24df78832157dc38a86904e4f3a510df905 /src/ui/window.rs
parentb816f3c91691d7dc521927cd4109861ca6d7dde8 (diff)
parent049a8088a78666816b36397b89215b1e01b7eb69 (diff)
downloadFurtherance-3070a42a39b45de78364c888cd28c84dca3ba7bb.tar.zst
Merge pull request #9 from musiclover382/i18n
Complete localization support
Diffstat (limited to 'src/ui/window.rs')
-rwxr-xr-xsrc/ui/window.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/ui/window.rs b/src/ui/window.rs
index baca851..c955451 100755
--- a/src/ui/window.rs
+++ b/src/ui/window.rs
@@ -15,6 +15,7 @@
 // along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 use adw::subclass::prelude::AdwApplicationWindowImpl;
+use gettextrs::*;
 use gtk::prelude::*;
 use gtk::subclass::prelude::*;
 use gtk::{gio, glib, CompositeTemplate};
@@ -176,9 +177,9 @@ impl FurtheranceWindow {
                     gtk::DialogFlags::MODAL,
                     gtk::MessageType::Error,
                     gtk::ButtonsType::Ok,
-                    Some("<span size='large'>No Task Name</span>"),
+                    Some(&format!("<span size='large'>{}</span>", &gettext("No Task Name"))),
                 );
-                dialog.set_secondary_text(Some("Enter a task name to start the timer."));
+                dialog.set_secondary_text(Some(&gettext("Enter a task name to start the timer.")));
                 dialog.show();
 
                 dialog.connect_response(clone!(@strong dialog => move |_,_|{
@@ -285,19 +286,20 @@ impl FurtheranceWindow {
         let m = (idle_time / 60) - (h * 60);
         let s = idle_time - (m * 60);
         let idle_time_str = format!(
-            "You have been idle for {:02}:{:02}:{:02}.\nWould you like to discard that time, or continue the clock?",
-            h, m, s);
+            "{}{:02}:{:02}:{:02}{}", gettext("You have been idle for "), h, m, s,
+            gettext(".\nWould you like to discard that time, or continue the clock?")
+            );
 
         let dialog = gtk::MessageDialog::with_markup(
             Some(self),
             gtk::DialogFlags::MODAL,
             gtk::MessageType::Warning,
             gtk::ButtonsType::None,
-            Some("<span size='x-large' weight='bold'>Edit Task</span>"),
+            Some(&format!("<span size='x-large' weight='bold'>{}</span>", &gettext("Edit Task"))),
         );
         dialog.add_buttons(&[
-            ("Discard", gtk::ResponseType::Reject),
-            ("Continue", gtk::ResponseType::Accept)
+            (&gettext("Discard"), gtk::ResponseType::Reject),
+            (&gettext("Continue"), gtk::ResponseType::Accept)
         ]);
         dialog.set_secondary_text(Some(&idle_time_str));