diff options
Diffstat (limited to 'src/components/post_editor.rs')
-rw-r--r-- | src/components/post_editor.rs | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/components/post_editor.rs b/src/components/post_editor.rs index 534b0dd..d1a6cf0 100644 --- a/src/components/post_editor.rs +++ b/src/components/post_editor.rs @@ -1,3 +1,4 @@ +use gettextrs::*; use crate::components; use crate::components::tag_pill::*; use adw::prelude::*; @@ -138,7 +139,7 @@ impl<E: std::error::Error + std::fmt::Debug + Send + 'static> Component for Post #[name = "name_label"] gtk::Label { - set_markup: "Name", + set_markup: &gettext("Name"), set_margin_horizontal: 10, set_halign: gtk::Align::Start, set_valign: gtk::Align::Center, @@ -153,7 +154,7 @@ impl<E: std::error::Error + std::fmt::Debug + Send + 'static> Component for Post #[name = "summary_label"] gtk::Label { - set_markup: "Summary", + set_markup: &gettext("Summary"), set_margin_horizontal: 10, set_halign: gtk::Align::Start, set_valign: gtk::Align::Center, @@ -175,7 +176,7 @@ impl<E: std::error::Error + std::fmt::Debug + Send + 'static> Component for Post #[name = "tag_label"] gtk::Label { - set_markup: "Tags", + set_markup: &gettext("Tags"), set_margin_horizontal: 10, set_halign: gtk::Align::Start, set_valign: gtk::Align::Center, @@ -223,7 +224,7 @@ impl<E: std::error::Error + std::fmt::Debug + Send + 'static> Component for Post #[name = "content_label"] gtk::Label { - set_markup: "Content", + set_markup: &gettext("Content"), set_halign: gtk::Align::Start, set_valign: gtk::Align::Start, set_margin_vertical: 10, @@ -276,7 +277,7 @@ impl<E: std::error::Error + std::fmt::Debug + Send + 'static> Component for Post #[name = "visibility_label"] gtk::Label { - set_markup: "Visibility", + set_markup: &gettext("Visibility"), set_halign: gtk::Align::Start, set_valign: gtk::Align::Start, set_margin_vertical: 10, @@ -373,7 +374,7 @@ impl<E: std::error::Error + std::fmt::Debug + Send + 'static> Component for Post [] as [gtk::Expression; 0], glib::closure::RustClosure::new(|v| { let list_item = v[0].get::<adw::EnumListItem>().unwrap(); - Some(list_item.name().into()) + Some(gettext(list_item.name().as_str()).into()) }) ) )); @@ -489,7 +490,7 @@ impl<E: std::error::Error + std::fmt::Debug + Send + 'static> Component for Post Input::SmartSummary(components::SmartSummaryOutput::Error(err)) => { self.set_smart_summary_busy_guard(None); - let toast = adw::Toast::new(&format!("Smart Summary error: {}", err)); + let toast = adw::Toast::new(&gettext!("Smart Summary error: {}", err)); toast.set_timeout(0); toast.set_priority(adw::ToastPriority::High); root.add_toast(toast); @@ -536,8 +537,8 @@ impl<E: std::error::Error + std::fmt::Debug + Send + 'static> Component for Post self.summary_buffer.set_text(""); self.tags.guard().clear(); self.content_buffer.set_text(""); - let toast = adw::Toast::new("Post submitted"); - toast.set_button_label(Some("Open")); + let toast = adw::Toast::new(&gettext("Post submitted")); + toast.set_button_label(Some(&gettext("Open"))); toast.connect_button_clicked(move |toast| { gtk::UriLauncher::new(&location.to_string()).launch( None::<&adw::ApplicationWindow>, @@ -555,7 +556,7 @@ impl<E: std::error::Error + std::fmt::Debug + Send + 'static> Component for Post root.add_toast(toast); }, Input::SubmitError(err) => { - let toast = adw::Toast::new(&format!("Error sending post: {}", err)); + let toast = adw::Toast::new(&gettext!("Error sending post: {}", err)); toast.set_timeout(0); toast.set_priority(adw::ToastPriority::High); |