From 86ff42c3003b34094a142e3e0714007fdc7857c1 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Sat, 23 Mar 2024 09:32:44 +0100 Subject: [PATCH] generate translation files --- choochoo/ticketview.py | 7 +- main.py | 2 +- po/LINGUAS | 1 + po/POTFILES.in | 6 ++ po/choochoo.pot | 210 +++++++++++++++++++++++++++++++++++++++++ po/meson.build | 4 + po/update_potfiles.sh | 61 ++++++++++++ 7 files changed, 289 insertions(+), 2 deletions(-) create mode 100644 po/LINGUAS create mode 100644 po/POTFILES.in create mode 100644 po/choochoo.pot create mode 100644 po/meson.build create mode 100644 po/update_potfiles.sh diff --git a/choochoo/ticketview.py b/choochoo/ticketview.py index e63d12d..3c7b222 100644 --- a/choochoo/ticketview.py +++ b/choochoo/ticketview.py @@ -21,9 +21,14 @@ class TicketScreen(Adw.NavigationPage): self.view = Adw.ToolbarView() self.header_bar = Adw.HeaderBar() + # realod item button - use to refresh qrcode (requires internet) self.reload_button = IconButton("", "view-refresh-symbolic", tooltip=_("Refresh Tickets")) self.reload_button.connect("clicked", lambda _: self.fetch()) - # TODO: delete button + # delete button + # shows confirm dialog + # removes the file & closes the window + self.delete_button = IconButton("", "user-trash-symbolic", tooltip=_("Delete Ticket")) + self.delete_button.connect("clicked", lambda _: self.fetch()) self.header_bar.pack_end(self.reload_button) self.view.add_top_bar(self.header_bar) self.overlay = Adw.ToastOverlay() diff --git a/main.py b/main.py index 4b2e696..0476117 100644 --- a/main.py +++ b/main.py @@ -2,7 +2,7 @@ # NOTE: translations do not work here import sys from choochoo.application import Application -Application.application_id = "icu.ccw.choochoo" +Application.application_id = "icu.ccw.ChooChoo" app = Application() try: diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 0000000..e5356f3 --- /dev/null +++ b/po/LINGUAS @@ -0,0 +1 @@ +# Please keep this list alphabetically sorted diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..135b1f3 --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,6 @@ +choochoo/home.py +choochoo/ticketview.py +choochoo/widgets/daterow.py +choochoo/window.py +data/icu.ccw.ChooChoo.desktop.in +data/icu.ccw.ChooChoo.metainfo.xml.in.in diff --git a/po/choochoo.pot b/po/choochoo.pot new file mode 100644 index 0000000..1180457 --- /dev/null +++ b/po/choochoo.pot @@ -0,0 +1,210 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the Choochoo package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Choochoo 0.2.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-03-23 09:32+0100\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=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../choochoo/home.py:15 +msgid "Tickets" +msgstr "" + +#: ../choochoo/home.py:19 ../choochoo/home.py:42 ../choochoo/home.py:100 +msgid "Add Ticket" +msgstr "" + +#: ../choochoo/home.py:22 ../choochoo/ticketview.py:25 +msgid "Refresh Tickets" +msgstr "" + +#: ../choochoo/home.py:28 +msgid "About" +msgstr "" + +#: ../choochoo/home.py:43 +msgid "The following information is required to add a ticket" +msgstr "" + +#: ../choochoo/home.py:47 +msgid "Ticket number (format: DTxxxxxx)" +msgstr "" + +#: ../choochoo/home.py:49 +msgid "Last name (as shown on ticket)" +msgstr "" + +#: ../choochoo/home.py:54 +msgid "Cancel" +msgstr "" + +#: ../choochoo/home.py:55 +msgid "Add" +msgstr "" + +#: ../choochoo/home.py:71 +msgid "Fetching ticket information" +msgstr "" + +#: ../choochoo/home.py:77 +msgid "Unable to add the ticket." +msgstr "" + +#: ../choochoo/home.py:81 +msgid "Done" +msgstr "" + +#: ../choochoo/home.py:97 +msgid "*crickets chirping*" +msgstr "" + +#: ../choochoo/home.py:98 +msgid "You haven't added any tickets" +msgstr "" + +#: ../choochoo/home.py:116 +msgid "Valid" +msgstr "" + +#: ../choochoo/home.py:117 +msgid "These tickets are currently valid" +msgstr "" + +#: ../choochoo/home.py:120 +msgid "Future" +msgstr "" + +#: ../choochoo/home.py:121 +msgid "" +"These tickets are not yet valid. They will be automatically moved to valid " +"tickets." +msgstr "" + +#: ../choochoo/home.py:124 +msgid "Invalid" +msgstr "" + +#: ../choochoo/home.py:125 +msgid "These tickets are no longer valid. You can delete them" +msgstr "" + +#: ../choochoo/home.py:138 +#, python-brace-format +msgid "Active for {month_name} {year}" +msgstr "" + +#: ../choochoo/ticketview.py:19 +msgid "My Ticket" +msgstr "" + +#: ../choochoo/ticketview.py:30 +msgid "Delete Ticket" +msgstr "" + +#: ../choochoo/ticketview.py:69 +msgid "D-Ticket" +msgstr "" + +#: ../choochoo/ticketview.py:70 +msgid "Show this at the ticket inspection" +msgstr "" + +#: ../choochoo/ticketview.py:86 +msgid "Ticket details" +msgstr "" + +#: ../choochoo/ticketview.py:87 +msgid "Validity and payment information" +msgstr "" + +#: ../choochoo/ticketview.py:89 +msgid "Issued on" +msgstr "" + +#: ../choochoo/ticketview.py:91 +msgid "Valid from" +msgstr "" + +#: ../choochoo/ticketview.py:93 +msgid "Valid until" +msgstr "" + +#: ../choochoo/ticketview.py:97 +msgid "Personal details" +msgstr "" + +#: ../choochoo/ticketview.py:98 +msgid "Who is traveling" +msgstr "" + +#: ../choochoo/ticketview.py:101 +msgid "Name" +msgstr "" + +#: ../choochoo/ticketview.py:107 +msgid "Birthdate" +msgstr "" + +#: ../choochoo/ticketview.py:111 +msgid "Important" +msgstr "" + +#: ../choochoo/ticketview.py:112 +msgid "" +"Only valid with an offical ID (e.g identity card). This must be shown at the " +"inspection." +msgstr "" + +#: ../choochoo/ticketview.py:115 +msgid "The terms and conditions of the respective carrier apply" +msgstr "" + +#: ../choochoo/ticketview.py:116 +#, python-brace-format +msgid "You can find these under: {url}" +msgstr "" + +#: ../choochoo/widgets/daterow.py:17 +#, python-brace-format +msgid "{day:02}.{month:02}.{year} {hour:02}:{minute:02}" +msgstr "" + +#: ../choochoo/widgets/daterow.py:25 +#, python-brace-format +msgid "{day:02}.{month:02}.{year}" +msgstr "" + +#: ../choochoo/window.py:20 +msgid "Unofficial DeutschlandTicket App" +msgstr "" + +#: ../data/icu.ccw.ChooChoo.desktop.in:3 +msgid "ChooChoo" +msgstr "" + +#: ../data/icu.ccw.ChooChoo.desktop.in:4 +msgid "Unofficial Deutschlandticket App" +msgstr "" + +#: ../data/icu.ccw.ChooChoo.desktop.in:13 +msgid "viewer" +msgstr "" + +#: ../data/icu.ccw.ChooChoo.metainfo.xml.in.in:28 +msgid "" +"ChooChoo allows you to add your DeutschlandTicket, by entering your " +"Ticketnumber (starts with DT) and the associated surname (probably yours). " +"It will then save the data on your disk, so you can show your ticket using " +"ChooChoo when asked" +msgstr "" diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 0000000..130707b --- /dev/null +++ b/po/meson.build @@ -0,0 +1,4 @@ +i18n = import('i18n') + +message('Update translations') +i18n.gettext(meson.project_name(), preset: 'glib') diff --git a/po/update_potfiles.sh b/po/update_potfiles.sh new file mode 100644 index 0000000..1d0e5b0 --- /dev/null +++ b/po/update_potfiles.sh @@ -0,0 +1,61 @@ +#!/bin/sh +# adapted from: https://codeberg.org/valos/Komikku/src/branch/main/po/update_potfiles.sh + +version=$(fgrep "version: " ../meson.build | grep -v "meson" | grep -o "'.*'" | sed "s/'//g") + +find ../choochoo -iname "*.py" | \ + xargs xgettext \ + --package-name=Choochoo \ + --package-version=$version \ + --from-code=UTF-8 \ + --output=choochoo-python.pot + +find ../data/ -iname "*.desktop.in" | \ + xargs xgettext \ + --package-name=Choochoo \ + --package-version=$version \ + --from-code=UTF-8 \ + --output=choochoo-desktop.pot \ + -L Desktop +find ../data/ -iname "*.metainfo.xml.in.in" | \ + xargs xgettext \ + --no-wrap \ + --package-name=Choochoo \ + --package-version=$version \ + --from-code=UTF-8 --output=choochoo-metainfo.pot + +msgcat \ + --sort-by-file \ + --use-first \ + --output-file=choochoo.pot \ + choochoo-python.pot \ + choochoo-desktop.pot \ + choochoo-metainfo.pot + +rm choochoo-*.pot + +cat choochoo.pot | \ + grep "^#:" | \ + cut -d: -f2 | \ + cut -d'/' -f2- | \ + sort | \ + uniq > POTFILES.in + +echo "# Please keep this list alphabetically sorted" > LINGUAS +for l in $(find -iname '*.po'); do basename $l .po >> LINGUAS; done + +for lang in $(sed "s/^#.*$//g" LINGUAS); do + mv "${lang}.po" "${lang}.po.old" + msginit --no-translator --locale=$lang --input choochoo.pot + mv "${lang}.po" "${lang}.po.new" + msgmerge -N "${lang}.po.old" "${lang}.po.new" > ${lang}.po + rm "${lang}.po.old" "${lang}.po.new" +done + +# To create language file use this command +# msginit --locale=LOCALE --input choochoo.pot +# where LOCALE is something like `de`, `it`, `es`... + +# To compile a .po file +# msgfmt --output-file=xx.mo xx.po +# where xx is something like `de`, `it`, `es`... -- 2.38.5