From 237c09966cc05f5aeeedfd93ef342dc8ff52eba2 Mon Sep 17 00:00:00 2001 From: Vika Date: Sun, 1 Sep 2024 19:04:08 +0300 Subject: 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. --- src/lib.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/lib.rs') 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 = >k::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(()) => {}, -- cgit 1.4.1