Commit fad6492f authored by Bilal Elmoussaoui's avatar Bilal Elmoussaoui

Merge branch '18-update-labels' into 'master'

Update labels Closes #18 See merge request GNOME/gnome-tour!12
parents d3b6be7d e5d70d9c
...@@ -33,6 +33,7 @@ impl Application { ...@@ -33,6 +33,7 @@ impl Application {
app.quit(); app.quit();
}), }),
); );
// Start Tour // Start Tour
utils::action( utils::action(
&self.app, &self.app,
...@@ -64,6 +65,7 @@ impl Application { ...@@ -64,6 +65,7 @@ impl Application {
} }
}), }),
); );
utils::action( utils::action(
&self.app, &self.app,
"previous-page", "previous-page",
...@@ -75,6 +77,7 @@ impl Application { ...@@ -75,6 +77,7 @@ impl Application {
} }
}), }),
); );
self.app.set_accels_for_action("app.quit", &["<primary>q"]); self.app.set_accels_for_action("app.quit", &["<primary>q"]);
} }
......
// based on https://gitlab.gnome.org/World/podcasts/-/blob/master/podcasts-gtk/src/i18n|utils.rs
use gettextrs::gettext;
pub fn action<T, F>(thing: &T, name: &str, action: F) pub fn action<T, F>(thing: &T, name: &str, action: F)
where where
T: gio::ActionMapExt, T: gio::ActionMapExt,
...@@ -10,3 +13,13 @@ where ...@@ -10,3 +13,13 @@ where
// Add it to the map // Add it to the map
thing.add_action(&act); thing.add_action(&act);
} }
pub fn i18n_f(format: &str, args: &[&str]) -> String {
let s = gettext(format);
let mut parts = s.split("{}");
let mut output = parts.next().unwrap_or("").to_string();
for (p, a) in parts.zip(args.iter()) {
output += &(a.to_string() + &p.to_string());
}
output
}
...@@ -34,7 +34,10 @@ impl ImagePageWidget { ...@@ -34,7 +34,10 @@ impl ImagePageWidget {
let container = gtk::Box::new(gtk::Orientation::Vertical, 12); let container = gtk::Box::new(gtk::Orientation::Vertical, 12);
container.set_halign(gtk::Align::Center); container.set_halign(gtk::Align::Center);
container.set_valign(gtk::Align::Center); container.set_valign(gtk::Align::Center);
container.set_property_margin(48); container.set_margin_bottom(48);
container.set_margin_top(12);
container.set_margin_start(12);
container.set_margin_end(12);
let image = gtk::Image::from_resource(&resource_uri); let image = gtk::Image::from_resource(&resource_uri);
image.set_valign(gtk::Align::Start); image.set_valign(gtk::Align::Start);
......
...@@ -51,7 +51,7 @@ impl WelcomePageWidget { ...@@ -51,7 +51,7 @@ impl WelcomePageWidget {
title.show(); title.show();
self.widget.add(&title); self.widget.add(&title);
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."))); let text = gtk::Label::new(Some(&gettext("Hi there! Take the tour to learn your way around and discover essential features.")));
text.get_style_context().add_class("body"); text.get_style_context().add_class("body");
text.set_margin_top(12); text.set_margin_top(12);
text.show(); text.show();
...@@ -69,7 +69,7 @@ impl WelcomePageWidget { ...@@ -69,7 +69,7 @@ impl WelcomePageWidget {
skip_tour_btn.show(); skip_tour_btn.show();
actions_container.add(&skip_tour_btn); actions_container.add(&skip_tour_btn);
let start_tour_btn = gtk::Button::with_label(&gettext("_Take the Tour")); let start_tour_btn = gtk::Button::with_label(&gettext("_Start Tour"));
start_tour_btn.set_property_height_request(40); start_tour_btn.set_property_height_request(40);
start_tour_btn.set_property_width_request(180); start_tour_btn.set_property_width_request(180);
start_tour_btn.set_use_underline(true); start_tour_btn.set_use_underline(true);
......
use crate::utils;
use gettextrs::gettext; use gettextrs::gettext;
use gtk::prelude::*; use gtk::prelude::*;
use std::cell::RefCell; use std::cell::RefCell;
...@@ -34,7 +35,7 @@ impl Window { ...@@ -34,7 +35,7 @@ impl Window {
} }
fn init(&mut self) { fn init(&mut self) {
self.widget.set_default_size(920, 640); self.widget.set_default_size(720, 500);
self.widget.set_icon_name(Some(APP_ID)); self.widget.set_icon_name(Some(APP_ID));
// Devel Profile // Devel Profile
...@@ -47,22 +48,22 @@ impl Window { ...@@ -47,22 +48,22 @@ impl Window {
self.paginator.borrow_mut().add_page(Box::new(ImagePageWidget::new( self.paginator.borrow_mut().add_page(Box::new(ImagePageWidget::new(
"/org/gnome/Tour/activities.svg", "/org/gnome/Tour/activities.svg",
gettext("Activities Overview"), gettext("Activities Overview"),
gettext("Open Activities to start apps"), gettext("Open Activities to launch apps"),
gettext("You can also view open windows, search and use workspaces."), gettext("The activities view can also be used to switch windows and search."),
))); )));
self.paginator.borrow_mut().add_page(Box::new(ImagePageWidget::new( self.paginator.borrow_mut().add_page(Box::new(ImagePageWidget::new(
"/org/gnome/Tour/search.svg", "/org/gnome/Tour/search.svg",
gettext("Search"), gettext("Search"),
gettext("In the Activities Overview, just start typing to search"), gettext("Just type to search"),
gettext("Search can be used to launch apps, find settings, do calculations and much more."), gettext("In the activities view, just start tying to search for apps, settings and more."),
))); )));
self.paginator.borrow_mut().add_page(Box::new(ImagePageWidget::new( self.paginator.borrow_mut().add_page(Box::new(ImagePageWidget::new(
"/org/gnome/Tour/calendar.svg", "/org/gnome/Tour/calendar.svg",
gettext("Date & Time"), gettext("Date & Time"),
gettext("Click the time to see your now and next"), gettext("Click the time to see notifications"),
gettext("This includes notifications, media controls, calendar events, the weather and world clocks."), gettext("The notifications popover also includes personal planning tools."),
))); )));
self.paginator.borrow_mut().add_page(Box::new(ImagePageWidget::new( self.paginator.borrow_mut().add_page(Box::new(ImagePageWidget::new(
...@@ -71,18 +72,20 @@ impl Window { ...@@ -71,18 +72,20 @@ impl Window {
gettext("View system information and settings"), gettext("View system information and settings"),
gettext("Get an overview of the system status and quickly change settings."), gettext("Get an overview of the system status and quickly change settings."),
))); )));
self.paginator.borrow_mut().add_page(Box::new(ImagePageWidget::new( self.paginator.borrow_mut().add_page(Box::new(ImagePageWidget::new(
"/org/gnome/Tour/software.svg", "/org/gnome/Tour/software.svg",
gettext("Software"), gettext("Software"),
gettext("Find and install apps"), gettext("Use Software to find and install apps"),
gettext("The Software app makes it easy to find and install all the apps you need."), gettext("Discover great apps through search, browsing and our recommendations."),
))); )));
let name = glib::get_os_info("NAME").unwrap_or("GNOME".into());
let last_page = ImagePageWidget::new( let last_page = ImagePageWidget::new(
"/org/gnome/Tour/ready-to-go.svg", "/org/gnome/Tour/ready-to-go.svg",
gettext("Learn More"), gettext("Tour Completed"),
gettext("That's it! To learn more, see the Help"), utils::i18n_f("That's it! We hope that you enjoy {}.", &[&name]),
gettext("The help app contains information, tips and tricks."), gettext("To get more advice and tips, see the Help app."),
); );
last_page.widget.get_style_context().add_class("last-page"); last_page.widget.get_style_context().add_class("last-page");
self.paginator.borrow_mut().add_page(Box::new(last_page)); self.paginator.borrow_mut().add_page(Box::new(last_page));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment