Changeset - 83d7cbad018a
[Not reviewed]
i18n
0 5 0
Dennis Fink - 3 years ago 2022-01-17 11:39:30
dennis.fink@c3l.lu
Add babel command to flask cli
5 files changed with 90 insertions and 48 deletions:
0 comments (0 inline, 0 general)
c3l_membership/__init__.py
Show inline comments
 
@@ -2,8 +2,10 @@ import base64
 
import json
 
import os.path
 
import secrets
 
import subprocess
 

	
 
from flask import Flask, g, redirect, request, url_for
 
from flask.cli import AppGroup
 
from flask_babel import Babel
 
from flask_qrcode import QRcode
 

	
 
@@ -11,6 +13,7 @@ config_file = os.path.abspath("/etc/memb
 

	
 
qrcode = QRcode()
 
babel = Babel()
 
babel_cli = AppGroup("babel")
 

	
 

	
 
def create_app():
 
@@ -66,7 +69,38 @@ def create_app():
 
        g.lang_code = request.accept_languages.best_match(app.config["LANGUAGES"])
 
        return redirect(url_for("root.index"))
 

	
 
    app.cli.add_command(babel_cli)
 

	
 
    return app
 

	
 

	
 
@babel_cli.command("extract")
 
def babel_extract():
 
    subprocess.run(
 
        [
 
            "pybabel",
 
            "extract",
 
            "-F",
 
            "babel.cfg",
 
            "-k",
 
            "lazy_gettext",
 
            "-o",
 
            "messages.pot",
 
            ".",
 
        ]
 
    )
 

	
 

	
 
@babel_cli.command("update")
 
def babel_update():
 
    subprocess.run(
 
        ["pybabel", "update", "-i", "messages.pot", "-d", "c3l_membership/translations"]
 
    )
 

	
 

	
 
@babel_cli.command("compile")
 
def babel_compile():
 
    subprocess.run(["pybabel", "compile", "-d", "c3l_membership/translations"])
 

	
 

	
 
app = create_app()
c3l_membership/translations/de/LC_MESSAGES/messages.po
Show inline comments
 
@@ -7,17 +7,16 @@ msgid ""
 
msgstr ""
 
"Project-Id-Version: PROJECT VERSION\n"
 
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
 
"POT-Creation-Date: 2022-01-17 11:29+0100\n"
 
"POT-Creation-Date: 2022-01-17 11:38+0100\n"
 
"PO-Revision-Date: 2022-01-17 11:30+0100\n"
 
"Last-Translator: Dennis Fink <dennis.fink@c3l.lu>\n"
 
"Language: de\n"
 
"Language-Team: de <LL@li.org>\n"
 
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
 
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
 
"MIME-Version: 1.0\n"
 
"Content-Type: text/plain; charset=utf-8\n"
 
"Content-Transfer-Encoding: 8bit\n"
 
"Generated-By: Babel 2.9.1\n"
 
"X-Generator: Poedit 3.0\n"
 

	
 
#: c3l_membership/forms.py:12
 
msgid "Username"
 
@@ -46,7 +45,8 @@ msgstr "Bitte wählen Sie eine der Optionen!"
 

	
 
#: c3l_membership/forms.py:36
 
msgid ""
 
"Regular membership - Membership with voting rights on the general assembly."
 
"Regular membership - Membership with voting rights on the general "
 
"assembly."
 
msgstr ""
 
"Ordentliche Mitgliedschaft - Mitgliedschaft mit Stimmrecht in der "
 
"Generalversammlung."
 
@@ -67,8 +67,8 @@ msgstr ""
 

	
 
#: c3l_membership/forms.py:56
 
msgid ""
 
"I am a starving hacker and cannot afford the membership! (Please get in touch "
 
"with us at info@c3l.lu before filling out this membership form)"
 
"I am a starving hacker and cannot afford the membership! (Please get in "
 
"touch with us at info@c3l.lu before filling out this membership form)"
 
msgstr ""
 
"Ich bin ein \"starving\" Hacker und kann mir die Mitgliedschaft nicht "
 
"leisten! (Bitte setzen Sie sich mit uns unter info@c3l.lu in Verbindung, "
 
@@ -108,13 +108,14 @@ msgid ""
 
"understood the <a href=\"http://statutes.c3l.lu\">statutes of the Chaos "
 
"Computer Club Lëtzebuerg A.S.B.L.</a>."
 
msgstr ""
 
"Mit dem Absenden dieses Mitgliedsantrags erklären Sie, die <a href=\"http://"
 
"statutes.c3l.lu\">Satzung des Chaos Computer Club Lëtzebuerg A.S.B.L.</a> "
 
"gelesen und verstanden zu haben."
 
"Mit dem Absenden dieses Mitgliedsantrags erklären Sie, die <a "
 
"href=\"http://statutes.c3l.lu\">Satzung des Chaos Computer Club "
 
"Lëtzebuerg A.S.B.L.</a> gelesen und verstanden zu haben."
 

	
 
#: c3l_membership/forms.py:100
 
msgid ""
 
"I am under 18 years of age and have the approval of my legal representative."
 
"I am under 18 years of age and have the approval of my legal "
 
"representative."
 
msgstr "Ich bin unter 18 Jahre alt und habe die Zustimmung meines Vormunds."
 

	
 
#: c3l_membership/forms.py:104
 
@@ -164,15 +165,15 @@ msgstr "Wie dieses Forumaler verwendet w
 

	
 
#: c3l_membership/templates/index.html:42
 
msgid ""
 
"Fill out this form and click on \"Become a member\". Afterwards you will be "
 
"presented with a PDF, which you have to send to info@c3l.lu or bring it to "
 
"one of our next events. Print it or save it to your local hardware, because "
 
"we don't save a copy on our servers for data protection reasons!"
 
"Fill out this form and click on \"Become a member\". Afterwards you will "
 
"be presented with a PDF, which you have to send to info@c3l.lu or bring "
 
"it to one of our next events. Print it or save it to your local hardware,"
 
" because we don't save a copy on our servers for data protection reasons!"
 
msgstr ""
 
"Füllen Sie dieses Formular aus und klicken Sie auf \"Mitglied werden\". "
 
"Danach erhalten Sie eine PDF-Datei, welches Sie an info@c3l.lu schicken oder "
 
"zu einer unserer nächsten Veranstaltungen mitbringen müssen. Drucken Sie es "
 
"aus oder speichern Sie es auf Ihrer lokalen Hardware, da wir aus "
 
"Danach erhalten Sie eine PDF-Datei, welches Sie an info@c3l.lu schicken "
 
"oder zu einer unserer nächsten Veranstaltungen mitbringen müssen. Drucken"
 
" Sie es aus oder speichern Sie es auf Ihrer lokalen Hardware, da wir aus "
 
"Datenschutzgründen keine Kopie auf unseren Servern speichern!"
 

	
 
#: c3l_membership/templates/index.html:53
 
@@ -182,7 +183,8 @@ msgstr "Erforderliche Informationen"
 
#: c3l_membership/templates/index.html:94
 
msgid "What's difference between the different membership options?"
 
msgstr ""
 
"Was ist der Unterschied zwischen den verschiedenen Mitgliedschaftsoptionen?"
 
"Was ist der Unterschied zwischen den verschiedenen "
 
"Mitgliedschaftsoptionen?"
 

	
 
#: c3l_membership/templates/index.html:95
 
msgid "All the options include to following benefits:"
 
@@ -190,19 +192,22 @@ msgstr "Alle Optionen bieten die folgend
 

	
 
#: c3l_membership/templates/index.html:97
 
msgid ""
 
"Access to the <a href=\"https://wiki.c3l.lu/doku.php?id=organization:"
 
"membership#benefits\">services</a> run by us"
 
"Access to the <a "
 
"href=\"https://wiki.c3l.lu/doku.php?id=organization:membership#benefits\">services</a>"
 
" run by us"
 
msgstr ""
 
"Zugang zu den von uns betriebenen <a href=\"https://wiki.c3l.lu/doku.php?"
 
"id=organization:membership#benefits\">Dienstleistungen</a>"
 
"Zugang zu den von uns betriebenen <a "
 
"href=\"https://wiki.c3l.lu/doku.php?id=organization:membership#benefits\">Dienstleistungen</a>"
 

	
 
#: c3l_membership/templates/index.html:98
 
msgid ""
 
"Access to our <a href=\"https://wiki.c3l.lu/doku.php?id=chaosstuff:bootstrap"
 
"\">hackerspace: ChaosStuff</a>"
 
"Access to our <a "
 
"href=\"https://wiki.c3l.lu/doku.php?id=chaosstuff:bootstrap\">hackerspace:"
 
" ChaosStuff</a>"
 
msgstr ""
 
"Zugang zu unserem <a href=\"https://wiki.c3l.lu/doku.php?id=chaosstuff:"
 
"bootstrap\">Hackerspace: ChaosStuff</a>"
 
"Zugang zu unserem <a "
 
"href=\"https://wiki.c3l.lu/doku.php?id=chaosstuff:bootstrap\">Hackerspace:"
 
" ChaosStuff</a>"
 

	
 
#: c3l_membership/templates/index.html:100
 
msgid "Becoming a regular member gives you these additional benefits:"
 
@@ -218,11 +223,12 @@ msgstr "Zugang zu unserer internen Maili
 

	
 
#: c3l_membership/templates/index.html:105
 
msgid ""
 
"You can read more on the membership <a href=\"https://wiki.c3l.lu/doku.php?"
 
"id=organization:membership\">here</a>."
 
"You can read more on the membership <a "
 
"href=\"https://wiki.c3l.lu/doku.php?id=organization:membership\">here</a>."
 
msgstr ""
 
"Mehr über die Mitgliedschaft können Sie <a href=\"https://wiki.c3l.lu/doku."
 
"php?id=organization:membership\">hier</a> lesen."
 
"Mehr über die Mitgliedschaft können Sie <a "
 
"href=\"https://wiki.c3l.lu/doku.php?id=organization:membership\">hier</a>"
 
" lesen."
 

	
 
#: c3l_membership/templates/index.html:106
 
msgid "What are the membership fees?"
 
@@ -231,16 +237,17 @@ msgstr "Wie hoch sind die Mitgliedsbeiträge?"
 
#: c3l_membership/templates/index.html:107
 
#, python-format
 
msgid ""
 
"The membership fee for the regular membership is %(regular_fee)s€ per year. "
 
"The membership fee for the supporting membership is %(supporting_fee)s€ per "
 
"year. If you are a student, all membership fees are %(supporting_fee)s€ per "
 
"year. For that please select the corresponding option."
 
"The membership fee for the regular membership is %(regular_fee)s€ per "
 
"year. The membership fee for the supporting membership is "
 
"%(supporting_fee)s€ per year. If you are a student, all membership fees "
 
"are %(supporting_fee)s€ per year. For that please select the "
 
"corresponding option."
 
msgstr ""
 
"Der Mitgliedsbeitrag für die reguläre Mitgliedschaft beträgt %(regular_fee)s€ "
 
"pro Jahr. Der Mitgliedsbeitrag für die Unterstützende Mitgliedschaft beträgt "
 
"%(supporting_fee)s€ pro Jahr. Wenn Sie Student sind, sind alle "
 
"Mitgliedsbeiträge %(supporting_fee)s€ pro Jahr. Bitte wählen Sie dazu die "
 
"entsprechende Option."
 
"Der Mitgliedsbeitrag für die reguläre Mitgliedschaft beträgt "
 
"%(regular_fee)s€ pro Jahr. Der Mitgliedsbeitrag für die Unterstützende "
 
"Mitgliedschaft beträgt %(supporting_fee)s€ pro Jahr. Wenn Sie Student "
 
"sind, sind alle Mitgliedsbeiträge %(supporting_fee)s€ pro Jahr. Bitte "
 
"wählen Sie dazu die entsprechende Option."
 

	
 
#: c3l_membership/templates/index.html:108
 
msgid "I cannot afford the membership?"
 
@@ -248,13 +255,13 @@ msgstr "Ich kann mir die Mitgliedschaft 
 

	
 
#: c3l_membership/templates/index.html:109
 
msgid ""
 
"If you cannot afford the membership, please contact us via info@c3l.lu first, "
 
"before filling out the membership form. We will try to find a solution "
 
"together."
 
"If you cannot afford the membership, please contact us via info@c3l.lu "
 
"first, before filling out the membership form. We will try to find a "
 
"solution together."
 
msgstr ""
 
"Wenn Sie sich die Mitgliedschaft nicht leisten können, kontaktieren Sie uns "
 
"bitte zuerst über info@c3l.lu, bevor Sie das Beitrittsformular ausfüllen. Wir "
 
"werden versuchen, gemeinsam eine Lösung zu finden."
 
"Wenn Sie sich die Mitgliedschaft nicht leisten können, kontaktieren Sie "
 
"uns bitte zuerst über info@c3l.lu, bevor Sie das Beitrittsformular "
 
"ausfüllen. Wir werden versuchen, gemeinsam eine Lösung zu finden."
 

	
 
#: c3l_membership/templates/index.html:122
 
msgid "Additional information"
 
@@ -409,3 +416,4 @@ msgstr "Unterschrift des Vormundes"
 
#: c3l_membership/templates/member.html:152
 
msgid "Your signature"
 
msgstr "Ihre Unterschrift"
 

	
c3l_membership/translations/fr/LC_MESSAGES/messages.po
Show inline comments
 
@@ -7,7 +7,7 @@ msgid ""
 
msgstr ""
 
"Project-Id-Version: PROJECT VERSION\n"
 
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
 
"POT-Creation-Date: 2022-01-17 11:29+0100\n"
 
"POT-Creation-Date: 2022-01-17 11:38+0100\n"
 
"PO-Revision-Date: 2022-01-16 22:17+0100\n"
 
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 
"Language: fr\n"
c3l_membership/translations/lb/LC_MESSAGES/messages.po
Show inline comments
 
@@ -7,7 +7,7 @@ msgid ""
 
msgstr ""
 
"Project-Id-Version: PROJECT VERSION\n"
 
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
 
"POT-Creation-Date: 2022-01-17 11:29+0100\n"
 
"POT-Creation-Date: 2022-01-17 11:38+0100\n"
 
"PO-Revision-Date: 2022-01-16 22:17+0100\n"
 
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 
"Language: lb\n"
messages.pot
Show inline comments
 
@@ -8,7 +8,7 @@ msgid ""
 
msgstr ""
 
"Project-Id-Version: PROJECT VERSION\n"
 
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
 
"POT-Creation-Date: 2022-01-17 11:29+0100\n"
 
"POT-Creation-Date: 2022-01-17 11:38+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"
0 comments (0 inline, 0 general)