summary refs log tree commit diff
path: root/src/components/signin.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/components/signin.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/components/signin.rs')
-rw-r--r--src/components/signin.rs19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/components/signin.rs b/src/components/signin.rs
index 08e850a..156686e 100644
--- a/src/components/signin.rs
+++ b/src/components/signin.rs
@@ -1,3 +1,4 @@
+use gettextrs::*;
 use std::cell::RefCell;
 
 use adw::prelude::*;
@@ -87,7 +88,7 @@ fn callback_handler(sender: AsyncComponentSender<SignIn>) -> impl Fn(&soup::Serv
                 msg.set_response(
                     Some("text/plain; charset=\"utf-8\""),
                     soup::MemoryUse::Static,
-                    "Thank you! This window can now be closed.".as_bytes()
+                    gettext("Thank you! This window can now be closed.").as_bytes()
                 );
                 msg.connect_finished(move |_| {
                     sender.input(Input::Callback(Ok(response.take().unwrap())));
@@ -206,12 +207,12 @@ impl AsyncComponent for SignIn {
 
                     gtk::Label {
                         add_css_class: "title-1",
-                        set_text: "Sign in",
+                        set_text: &gettext("Sign in"),
                         set_justify: gtk::Justification::Center,
                     },
 
                     gtk::Label {
-                        set_text: "Please sign in with your website to use Bowl.\nYour website needs to support IndieAuth and Micropub for this app to work.",
+                        set_text: &gettext("Please sign in with your website to use Bowl.\nYour website needs to support IndieAuth and Micropub for this app to work."),
                         set_wrap: true,
                         set_halign: gtk::Align::BaselineCenter,
                         set_valign: gtk::Align::BaselineCenter,
@@ -240,12 +241,12 @@ impl AsyncComponent for SignIn {
                             },
                             gtk::Label {
                                 #[watch]
-                                set_text: if model.busy_guard.is_some() {
-                                    "Talking to your website..."
+                                set_text: &if model.busy_guard.is_some() {
+                                    gettext("Talking to your website...")
                                 } else if model.callback_server.is_some() {
-                                    "Waiting for authorization..."
+                                    gettext("Waiting for authorization...")
                                 } else {
-                                    "Sign in"
+                                    gettext("Sign in")
                                 },
                             }
                         },
@@ -451,7 +452,7 @@ impl AsyncComponent for SignIn {
                 if res.state != self.state {
                     return self.bail_out(widgets, sender, IndieauthError {
                         kind: kittybox_indieauth::ErrorKind::InvalidRequest,
-                        msg: Some("state doesn't match what we remember, ceremony aborted".to_owned()),
+                        msg: Some(gettext("state doesn't match what we remember, ceremony aborted")),
                         error_uri: None,
                     }.into())
                 }
@@ -459,7 +460,7 @@ impl AsyncComponent for SignIn {
                 if res.iss != metadata.issuer {
                     return self.bail_out(widgets, sender, IndieauthError {
                         kind: kittybox_indieauth::ErrorKind::InvalidRequest,
-                        msg: Some("issuer doesn't match what we remember, ceremony aborted".to_owned()),
+                        msg: Some(gettext("issuer doesn't match what we remember, ceremony aborted")),
                         error_uri: None,
                     }.into())
                 }