summary refs log tree commit diff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2024-09-01 19:04:08 +0300
committerVika <vika@fireburn.ru>2024-09-04 19:51:50 +0300
commit237c09966cc05f5aeeedfd93ef342dc8ff52eba2 (patch)
treef59bfe86bbec5c92056f0a8f27e46073e10792af /src/lib.rs
parentf8d61d957d4a2d086f4b97f2e3d7d19d0bb35f13 (diff)
Gettextize and add Russian translation
This is a very shitty translation, but it can be improved later. I
added it mostly as a test for translations working correctly, since I
know Russian and might as well translate the app into the language.
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 530eab6..ee92350 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,3 +1,4 @@
+use gettextrs::*;
 use adw::prelude::*;
 use libsecret::prelude::{RetrievableExtManual, RetrievableExt};
 use relm4::{actions::{RelmAction, RelmActionGroup}, gtk, loading_widgets::LoadingWidgets, prelude::{AsyncComponent, AsyncComponentController, AsyncComponentParts, AsyncController, ComponentController, Controller}, AsyncComponentSender, Component, RelmWidgetExt};
@@ -14,7 +15,7 @@ pub mod components {
     };
 
     pub(crate) mod tag_pill;
-    // pub(crate) use tag_pill::{TagPill, TagPillDelete};
+    // pub(crate) use tag_pill::{TagPill, TagPillDelete}
 
     pub mod signin;
     pub use signin::{SignIn, Output as SignInOutput};
@@ -127,7 +128,7 @@ impl App {
 
     fn about() -> adw::AboutDialog {
         adw::AboutDialog::builder()
-            .application_name("Bowl for Kittybox")
+            .application_name(gettext("Bowl for Kittybox"))
             .developer_name("Vika Shleina")
             .version(env!("CARGO_PKG_VERSION"))
             .website("https://kittybox.fireburn.ru/bowl/")
@@ -165,9 +166,9 @@ impl AsyncComponent for App {
 
     menu! {
         main_menu: {
-            "Sign out" => SignOutAction,
-            "Preferences" => PreferencesAction,
-            "About" => AboutAction,
+            &gettext("Sign out") => SignOutAction,
+            &gettext("Preferences") => PreferencesAction,
+            &gettext("About") => AboutAction,
         }
     }
 
@@ -181,10 +182,10 @@ impl AsyncComponent for App {
 
             #[watch]
             set_title: if model.micropub.is_none() {
-                Some("Bowl – Sign in with your website")
+                Some(gettext("Bowl - Sign in with your website"))
             } else {
-                Some("Bowl")
-            },
+                Some(gettext("Bowl"))
+            }.as_deref(),
 
             adw::ToolbarView {
                 add_top_bar = &adw::HeaderBar {
@@ -197,7 +198,7 @@ impl AsyncComponent for App {
                     },
                     pack_end = &gtk::Button {
                         set_icon_name: "document-send-symbolic",
-                        set_tooltip: "Send post",
+                        set_tooltip: &gettext("Publish"),
                         #[watch]
                         set_visible: model.micropub.is_some(),
                         #[watch]
@@ -327,7 +328,7 @@ impl AsyncComponent for App {
                     Some(&self.secret_schema),
                     attributes.clone(),
                     Some(libsecret::COLLECTION_DEFAULT),
-                    &format!("Micropub access token for {}", &data.me),
+                    &gettext!("Micropub access token for {}", &data.me),
                     &data.access_token
                 ).await {
                     Ok(()) => {},