Skip to content

Commit

Permalink
feat:[Vanilla-OS#11] Add localization for slides
Browse files Browse the repository at this point in the history
- Add en_GB.po file
- Pass strings to gettext before constructing slides
- Add translation support metainfo
  • Loading branch information
jardon committed Sep 14, 2024
1 parent 68e9f81 commit 7aaeb51
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 7 deletions.
1 change: 1 addition & 0 deletions data/org.vanillaos.Tour.metainfo.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
<description>
<p>No description</p>
</description>
<translation type="gettext">org.vanillaos.Tour</translation>
</component>
1 change: 1 addition & 0 deletions po/LINGUAS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
en_GB
87 changes: 87 additions & 0 deletions po/en_GB.po
Original file line number Diff line number Diff line change
@@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\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 ""
2 changes: 1 addition & 1 deletion po/meson.build
Original file line number Diff line number Diff line change
@@ -1 +1 @@
i18n.gettext('tour', preset: 'glib')
i18n.gettext('vanilla-tour', preset: 'glib')
10 changes: 7 additions & 3 deletions vanilla_tour/slide.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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://"):
Expand Down
6 changes: 3 additions & 3 deletions vanilla_tour/vanilla-tour.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7aaeb51

Please sign in to comment.