From 7aaeb51c9647459517ef7fc29cccc3bc80d993dd Mon Sep 17 00:00:00 2001 From: Jarred Wilson Date: Thu, 12 Sep 2024 12:20:30 +0000 Subject: [PATCH] feat:[#11] Add localization for slides - Add en_GB.po file - Pass strings to gettext before constructing slides - Add translation support metainfo --- data/org.vanillaos.Tour.metainfo.xml.in | 1 + po/LINGUAS | 1 + po/en_GB.po | 87 +++++++++++++++++++++++++ po/meson.build | 2 +- vanilla_tour/slide.py | 10 ++- vanilla_tour/vanilla-tour.in | 6 +- 6 files changed, 100 insertions(+), 7 deletions(-) create mode 100644 po/en_GB.po diff --git a/data/org.vanillaos.Tour.metainfo.xml.in b/data/org.vanillaos.Tour.metainfo.xml.in index 26bdcdc..9e60178 100644 --- a/data/org.vanillaos.Tour.metainfo.xml.in +++ b/data/org.vanillaos.Tour.metainfo.xml.in @@ -6,4 +6,5 @@

No description

+ org.vanillaos.Tour diff --git a/po/LINGUAS b/po/LINGUAS index e69de29..daa2955 100644 --- a/po/LINGUAS +++ b/po/LINGUAS @@ -0,0 +1 @@ +en_GB diff --git a/po/en_GB.po b/po/en_GB.po new file mode 100644 index 0000000..9ad8811 --- /dev/null +++ b/po/en_GB.po @@ -0,0 +1,87 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the vanilla-installer package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: vanilla-tour\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-01-30 16:48+0530\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "Vanilla OS 2 Orchid" +msgstr "" + +msgid "Solid. Secure. Maintenance-free." +msgstr "" + +msgid "Your Favorite Apps, Right Here" +msgstr "" + +msgid "Android Compatibility" +msgstr "" + +msgid "Develop, The Way You Like" +msgstr "" + +msgid "Get an Overview" +msgstr "" + +msgid "Configure Your Device" +msgstr "" + +msgid "Connect Your Online Accounts" +msgstr "" + +msgid "There is More" +msgstr "" + +msgid "Let's take a short tour." +msgstr "" + +msgid "Vanilla OS is developed with security in mind. Updates are automatic and run in the background, they won't get in your way." +msgstr "" + +msgid "From your favorite music player, to your trusted web browser. They are all available, install them from the store." +msgstr "" + +msgid "Is that app you love so much only on Android? We've got you covered, Vanilla OS supports APKs." +msgstr "" + +msgid "Vanilla OS comes with APX, a tool that allows you to create integrated and extensible development environments, ready for your every need." +msgstr "" + +msgid "Press the Super key to see open windows and apps." +msgstr "" + +msgid "From Bluetooth devices to that wallpaper you love so much. The settings panel allows you to configure it as you like." +msgstr "" + +msgid "Do you have a Gmail, Outlook, Nextcloud or other account? Connect them to your Vanilla OS device to integrate email, calendars.. everything." +msgstr "" + +msgid "Find out more about all the Orchid news and features on our blog." +msgstr "" + +msgid "Configure Updates" +msgstr "" + +msgid "Open the Store" +msgstr "" + +msgid "Open the Settings" +msgstr "" + +msgid "Connect an Account" +msgstr "" + +msgid "Visit the Blog" +msgstr "" diff --git a/po/meson.build b/po/meson.build index afdd879..3170655 100644 --- a/po/meson.build +++ b/po/meson.build @@ -1 +1 @@ -i18n.gettext('tour', preset: 'glib') +i18n.gettext('vanilla-tour', preset: 'glib') diff --git a/vanilla_tour/slide.py b/vanilla_tour/slide.py index ab04fa5..f7d91ee 100644 --- a/vanilla_tour/slide.py +++ b/vanilla_tour/slide.py @@ -19,6 +19,10 @@ from gi.repository import Adw, Gtk, GLib import webbrowser +import gettext +from gettext import gettext as _ + +gettext.textdomain("vanilla-tour") @Gtk.Template(resource_path="/org/vanillaos/Tour/blp/slide.ui") class Slide(Adw.Bin): @@ -37,12 +41,12 @@ def __init__(self, slide, **kwargs): def __build_ui(self): self.assets_svg.set_resource(self.__slide["resource"]) - self.status_page.set_title(self.__slide["title"]) - self.status_page.set_description(self.__slide["description"]) + self.status_page.set_title(_(self.__slide["title"])) + self.status_page.set_description(_(self.__slide["description"])) if "action" in self.__slide: self.btn_action.set_visible(True) - self.btn_action.set_label(self.__slide["action"]["title"]) + self.btn_action.set_label(_(self.__slide["action"]["title"])) def __on_btn_action_clicked(self, widget): if self.__slide["action"]["callback"].startswith("url://"): diff --git a/vanilla_tour/vanilla-tour.in b/vanilla_tour/vanilla-tour.in index d5c9095..aa59c91 100755 --- a/vanilla_tour/vanilla-tour.in +++ b/vanilla_tour/vanilla-tour.in @@ -31,9 +31,9 @@ localedir = '@localedir@' sys.path.insert(1, pkgdatadir) signal.signal(signal.SIGINT, signal.SIG_DFL) -locale.bindtextdomain('tour', localedir) -locale.textdomain('tour') -gettext.install('tour', localedir) +locale.bindtextdomain('vanilla-tour', localedir) +locale.textdomain('vanilla-tour') +gettext.install('vanilla-tour', localedir) if __name__ == '__main__': import gi