[gnome-tour/bilelmoussaoui/design-review] Prepare i18n
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tour/bilelmoussaoui/design-review] Prepare i18n
- Date: Wed, 29 Jan 2020 14:29:09 +0000 (UTC)
commit efa5daacdbfa931c290ff2e45ed8bec7222f9934
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date: Wed Jan 29 15:27:30 2020 +0100
Prepare i18n
po/POTFILES.in | 8 +++-----
src/widgets/headerbar.rs | 9 +++++----
src/widgets/pages/image.rs | 8 ++++----
src/widgets/pages/welcome.rs | 9 +++++----
src/widgets/window.rs | 37 +++++++++++++++++++------------------
5 files changed, 36 insertions(+), 35 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index fd5961a..37df7c4 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,7 +1,5 @@
data/org.gnome.Tour.metainfo.xml.in.in
data/org.gnome.Tour.desktop.in.in
-data/org.gnome.Tour.gschema.xml.in
-data/resources/ui/about_dialog.ui.in
-data/resources/ui/menu.ui
-data/resources/ui/shortcuts.ui
-data/resources/ui/window.ui.in
+src/widgets/pages/welcome.rs
+src/widgets/headerbar.rs
+src/widgets/window.rs
diff --git a/src/widgets/headerbar.rs b/src/widgets/headerbar.rs
index 44534a6..3443ffc 100644
--- a/src/widgets/headerbar.rs
+++ b/src/widgets/headerbar.rs
@@ -1,3 +1,4 @@
+use gettextrs::gettext;
use gtk::prelude::*;
pub struct HeaderBar {
@@ -24,9 +25,9 @@ impl HeaderBar {
pub fn set_page_nr(&self, page_nr: i32, total_pages: i32) {
if page_nr == total_pages {
- self.next_btn.set_label("Done");
+ self.next_btn.set_label(&gettext("Close"));
} else {
- self.next_btn.set_label("Next");
+ self.next_btn.set_label(&gettext("Next"));
}
}
@@ -48,7 +49,7 @@ impl HeaderBar {
let container = gtk::HeaderBar::new();
container.set_show_title_buttons(true);
- container.set_title(Some("Welcome Tour"));
+ container.set_title(Some(&gettext("Welcome Tour")));
self.widget.add_named(&container, "welcome");
let previous_btn = gtk::Button::new();
@@ -58,7 +59,7 @@ impl HeaderBar {
previous_btn.set_hexpand(true);
previous_btn.set_property_width_request(60);
- self.next_btn.add(>k::Label::new(Some("Next")));
+ self.next_btn.add(>k::Label::new(Some(&gettext("Next"))));
self.next_btn.get_style_context().add_class("suggested-action");
self.next_btn.set_action_name(Some("app.next-page"));
self.next_btn.set_halign(gtk::Align::End);
diff --git a/src/widgets/pages/image.rs b/src/widgets/pages/image.rs
index 7d1fb4e..fe523b3 100644
--- a/src/widgets/pages/image.rs
+++ b/src/widgets/pages/image.rs
@@ -28,15 +28,15 @@ impl Pageable for ImagePageWidget {
}
impl ImagePageWidget {
- pub fn new(resource_uri: &str, title: &str, head: &str, body: &str) -> Self {
+ pub fn new(resource_uri: &str, title: String, head: String, body: String) -> Self {
let widget = gtk::Box::new(gtk::Orientation::Vertical, 12);
let image_page = Self {
widget,
resource_uri: resource_uri.to_string(),
- title: title.to_string(),
- head: head.to_string(),
- body: body.to_string(),
+ title,
+ head,
+ body,
};
image_page.init();
diff --git a/src/widgets/pages/welcome.rs b/src/widgets/pages/welcome.rs
index 5ae2500..956469f 100644
--- a/src/widgets/pages/welcome.rs
+++ b/src/widgets/pages/welcome.rs
@@ -1,3 +1,4 @@
+use gettextrs::gettext;
use gtk::prelude::*;
pub struct WelcomePageWidget {
@@ -24,12 +25,12 @@ impl WelcomePageWidget {
logo.set_pixel_size(196);
self.widget.add(&logo);
- let title = gtk::Label::new(Some("Welcome to GNOME 3.34"));
+ let title = gtk::Label::new(Some(&gettext("Welcome to GNOME 3.34")));
title.set_margin_top(36);
title.get_style_context().add_class("large-title");
self.widget.add(&title);
- let text = gtk::Label::new(Some("Hi there! If you are new to GNOME, you can take the tour to learn
some essential features."));
+ let text = gtk::Label::new(Some(&gettext("Hi there! If you are new to GNOME, you can take the tour
to learn some essential features.")));
text.get_style_context().add_class("body");
text.set_margin_top(12);
self.widget.add(&text);
@@ -39,14 +40,14 @@ impl WelcomePageWidget {
actions_container.set_margin_top(36);
let start_tour_btn = gtk::Button::new();
- start_tour_btn.add(>k::Label::new(Some("Take the Tour")));
+ start_tour_btn.add(>k::Label::new(Some(&gettext("Take the Tour"))));
start_tour_btn.get_style_context().add_class("suggested-action");
start_tour_btn.set_property_height_request(40);
start_tour_btn.set_property_width_request(180);
start_tour_btn.set_action_name(Some("app.start-tour"));
let skip_tour_btn = gtk::Button::new();
- skip_tour_btn.add(>k::Label::new(Some("No Thanks")));
+ skip_tour_btn.add(>k::Label::new(Some(&gettext("No Thanks"))));
skip_tour_btn.set_property_height_request(40);
skip_tour_btn.set_property_width_request(180);
skip_tour_btn.set_action_name(Some("app.skip-tour"));
diff --git a/src/widgets/window.rs b/src/widgets/window.rs
index a1dd3a8..4e91199 100644
--- a/src/widgets/window.rs
+++ b/src/widgets/window.rs
@@ -1,3 +1,4 @@
+use gettextrs::gettext;
use gtk::prelude::*;
use super::headerbar::HeaderBar;
@@ -90,43 +91,43 @@ impl Window {
self.paginator.add_page(Box::new(ImagePageWidget::new(
"/org/gnome/Tour/activities.svg",
- "Activities Overview",
- "Open Activities to start apps",
- "You can also view open windows, search and use workspaces.",
+ gettext("Activities Overview"),
+ gettext("Open Activities to start apps"),
+ gettext("You can also view open windows, search and use workspaces."),
)));
self.paginator.add_page(Box::new(ImagePageWidget::new(
"/org/gnome/Tour/search.svg",
- "Search",
- "In the Activities Overview, just start typing to search",
- "Search can be used to launch apps, find settings, do calculations and much more.",
+ gettext("Search"),
+ gettext("In the Activities Overview, just start typing to search"),
+ gettext("Search can be used to launch apps, find settings, do calculations and much more."),
)));
self.paginator.add_page(Box::new(ImagePageWidget::new(
"/org/gnome/Tour/calendar.svg",
- "Date & Time",
- "Click the time to see your now and next",
- "This includes notifications, media controls, calendar events, the weather and world clocks.",
+ gettext("Date & Time"),
+ gettext("Click the time to see your now and next"),
+ gettext("This includes notifications, media controls, calendar events, the weather and world
clocks."),
)));
self.paginator.add_page(Box::new(ImagePageWidget::new(
"/org/gnome/Tour/status-menu.svg",
- "System Menu",
- "View system information and settings",
- "Get an overview of the system status and quickly change settings.",
+ gettext("System Menu"),
+ gettext("View system information and settings"),
+ gettext("Get an overview of the system status and quickly change settings."),
)));
self.paginator.add_page(Box::new(ImagePageWidget::new(
"/org/gnome/Tour/software.svg",
- "Software",
- "Find and install apps",
- "The Software app makese it easy to find and install all the apps you need.",
+ gettext("Software"),
+ gettext("Find and install apps"),
+ gettext("The Software app makese it easy to find and install all the apps you need."),
)));
self.paginator.add_page(Box::new(ImagePageWidget::new(
"/org/gnome/Tour/help.svg",
- "Learn More",
- "That's it! To learn more, see the Help",
- "The help app contains information, tips and tricks.",
+ gettext("Learn More"),
+ gettext("That's it! To learn more, see the Help"),
+ gettext("The help app contains information, tips and tricks."),
)));
self.container.add_named(&self.paginator.widget, "pages");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]