~comcloudway/choochoo

86ff42c3003b34094a142e3e0714007fdc7857c1 — Jakob Meier 5 months ago ff2c3ba
generate translation files
7 files changed, 289 insertions(+), 2 deletions(-)

M choochoo/ticketview.py
M main.py
A po/LINGUAS
A po/POTFILES.in
A po/choochoo.pot
A po/meson.build
A po/update_potfiles.sh
M choochoo/ticketview.py => choochoo/ticketview.py +6 -1
@@ 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()

M main.py => main.py +1 -1
@@ 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:

A po/LINGUAS => po/LINGUAS +1 -0
@@ 0,0 1,1 @@
# Please keep this list alphabetically sorted

A po/POTFILES.in => po/POTFILES.in +6 -0
@@ 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

A po/choochoo.pot => po/choochoo.pot +210 -0
@@ 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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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 ""

A po/meson.build => po/meson.build +4 -0
@@ 0,0 1,4 @@
i18n = import('i18n')

message('Update translations')
i18n.gettext(meson.project_name(), preset: 'glib')

A po/update_potfiles.sh => po/update_potfiles.sh +61 -0
@@ 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`...