Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix translations with parameters. #13

Merged
merged 1 commit into from
Mar 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-03-19 00:27+0100\n"
"POT-Creation-Date: 2021-03-20 23:21+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"
Expand Down Expand Up @@ -46,7 +46,8 @@ msgid "Error: The entered mail does not contain an @."
msgstr ""

#: webserver.py:106 webserver.py:109
msgid "Error: Email invalid. The domain %(domain) does not have an MX record."
#, python-format
msgid "Error: Email invalid. The domain %(domain)s does not have an MX record."
msgstr ""

#: webserver.py:115
Expand Down Expand Up @@ -90,15 +91,18 @@ msgid "Error: You need to be logged in to subscribe."
msgstr ""

#: webserver.py:218
msgid "Error: You are already subscribed to %(node)!"
#, python-format
msgid "Error: You are already subscribed to %(node)s!"
msgstr ""

#: webserver.py:229
msgid "Subscribed to node %(node)."
#, python-format
msgid "Subscribed to node %(node)s."
msgstr ""

#: webserver.py:256
msgid "Error: Node with nodeid %(nodeid) not found!"
#, python-format
msgid "Error: Node with nodeid %(nodeid)s not found!"
msgstr ""

#: webserver.py:267
Expand All @@ -110,19 +114,23 @@ msgid "Error: Unsubscribe failed. No nodeid was given."
msgstr ""

#: webserver.py:281
msgid "Error: Unsubscribe failed. Node with nodeid %(nodeid) not found!"
#, python-format
msgid "Error: Unsubscribe failed. Node with nodeid %(nodeid)s not found!"
msgstr ""

#: webserver.py:287
msgid "Error: Unsubscribe failed. You were not subscribed to %(node)!"
#, python-format
msgid "Error: Unsubscribe failed. You were not subscribed to %(node)s!"
msgstr ""

#: webserver.py:293
msgid "Sucessfully unsubscribed from %(node)!"
#, python-format
msgid "Sucessfully unsubscribed from %(node)s!"
msgstr ""

#: webserver.py:298
msgid "Node %(node) was removed, because nobody subscribes to it anymore."
#, python-format
msgid "Node %(node)s was removed, because nobody subscribes to it anymore."
msgstr ""

#: templates/404.html:4
Expand Down
44 changes: 27 additions & 17 deletions translations/de/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-03-19 00:27+0100\n"
"POT-Creation-Date: 2021-03-20 23:21+0100\n"
"PO-Revision-Date: 2021-02-28 16:40+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: de\n"
Expand Down Expand Up @@ -78,9 +78,10 @@ msgid "Error: The entered mail does not contain an @."
msgstr "Fehler: Die eingegebene Mail-Adresse enthält kein @."

#: webserver.py:106 webserver.py:109
msgid "Error: Email invalid. The domain %(domain) does not have an MX record."
#, python-format
msgid "Error: Email invalid. The domain %(domain)s does not have an MX record."
msgstr ""
"Fehler: Ungültige E-Mail-Adresse. Die Domain %(domain) hat keinen MX-"
"Fehler: Ungültige E-Mail-Adresse. Die Domain %(domain)s hat keinen MX-"
"Record."

#: webserver.py:115
Expand Down Expand Up @@ -128,16 +129,19 @@ msgid "Error: You need to be logged in to subscribe."
msgstr "Fehler: Du musst eingeloggt sein, um Router-Infos zu abonnieren."

#: webserver.py:218
msgid "Error: You are already subscribed to %(node)!"
msgstr "Fehler: Du hast %(node) bereits abonniert!"
#, python-format
msgid "Error: You are already subscribed to %(node)s!"
msgstr "Fehler: Du hast %(node)s bereits abonniert!"

#: webserver.py:229
msgid "Subscribed to node %(node)."
msgstr "Knoten %(node) abonniert."
#, python-format
msgid "Subscribed to node %(node)s."
msgstr "Knoten %(node)s abonniert."

#: webserver.py:256
msgid "Error: Node with nodeid %(nodeid) not found!"
msgstr "Fehler: Knoten %(nodeid) wurde nicht gefunden!"
#, python-format
msgid "Error: Node with nodeid %(nodeid)s not found!"
msgstr ""

#: webserver.py:267
msgid "Error: You need to be logged in to unsubscribe."
Expand All @@ -148,22 +152,28 @@ msgid "Error: Unsubscribe failed. No nodeid was given."
msgstr "Fehler: Abbestellung fehlgeschlagen. Es wurde keine Knoten-ID angegeben."

#: webserver.py:281
msgid "Error: Unsubscribe failed. Node with nodeid %(nodeid) not found!"
msgstr "Fehler: Abbestellung fehlgeschlagen. Der Knoten mit der ID "
#, python-format
msgid "Error: Unsubscribe failed. Node with nodeid %(nodeid)s not found!"
msgstr ""
"Fehler: Abbestellung fehlgeschlagen. Der Knoten mit der ID %(nodeid)s "
"wurde nicht gefunden!"

#: webserver.py:287
msgid "Error: Unsubscribe failed. You were not subscribed to %(node)!"
#, python-format
msgid "Error: Unsubscribe failed. You were not subscribed to %(node)s!"
msgstr ""
"Fehler: Abbestellung fehlgeschlagen. Du hattest Knoten %(node) nicht "
"Fehler: Abbestellung fehlgeschlagen. Du hattest Knoten %(node)s nicht "
"abonniert."

#: webserver.py:293
msgid "Sucessfully unsubscribed from %(node)!"
msgstr "Knoten %(node) erfolgreich abbestellt."
#, python-format
msgid "Sucessfully unsubscribed from %(node)s!"
msgstr "Knoten %(node)s erfolgreich abbestellt."

#: webserver.py:298
msgid "Node %(node) was removed, because nobody subscribes to it anymore."
msgstr "Knoten %(node) wurde entfernt, da ihn niemand mehr abonniert hat."
#, python-format
msgid "Node %(node)s was removed, because nobody subscribes to it anymore."
msgstr "Knoten %(node)s wurde entfernt, da ihn niemand mehr abonniert hat."

#: templates/404.html:4
msgid "404 - Not Found"
Expand Down
16 changes: 8 additions & 8 deletions translations/en/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ msgid "Error: The entered mail does not contain an @."
msgstr ""

#: webserver.py:106 webserver.py:109
msgid "Error: Email invalid. The domain %(domain) does not have an MX record."
msgid "Error: Email invalid. The domain %(domain)s does not have an MX record."
msgstr ""

#: webserver.py:115
Expand Down Expand Up @@ -122,15 +122,15 @@ msgid "Error: You need to be logged in to subscribe."
msgstr ""

#: webserver.py:218
msgid "Error: You are already subscribed to %(node)!"
msgid "Error: You are already subscribed to %(node)s!"
msgstr ""

#: webserver.py:229
msgid "Subscribed to node %(node)."
msgid "Subscribed to node %(node)s."
msgstr ""

#: webserver.py:256
msgid "Error: Node with nodeid %(nodeid) not found!"
msgid "Error: Node with nodeid %(nodeid)s not found!"
msgstr ""

#: webserver.py:267
Expand All @@ -142,19 +142,19 @@ msgid "Error: Unsubscribe failed. No nodeid was given."
msgstr ""

#: webserver.py:281
msgid "Error: Unsubscribe failed. Node with nodeid %(nodeid) not found!"
msgid "Error: Unsubscribe failed. Node with nodeid %(nodeid)s not found!"
msgstr ""

#: webserver.py:287
msgid "Error: Unsubscribe failed. You were not subscribed to %(node)!"
msgid "Error: Unsubscribe failed. You were not subscribed to %(node)s!"
msgstr ""

#: webserver.py:293
msgid "Sucessfully unsubscribed from %(node)!"
msgid "Sucessfully unsubscribed from %(node)s!"
msgstr ""

#: webserver.py:298
msgid "Node %(node) was removed, because nobody subscribes to it anymore."
msgid "Node %(node)s was removed, because nobody subscribes to it anymore."
msgstr ""

#: templates/404.html:4
Expand Down
18 changes: 9 additions & 9 deletions webserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ def res(code):
try:
dns.resolver.query(domain, 'MX')
except dns.resolver.Timeout:
flash(gettext('Error: Email invalid. The domain %(domain) does not have an MX record.', domain), 'danger')
flash(gettext('Error: Email invalid. The domain %(domain)s does not have an MX record.', domain=domain), 'danger')
return res(400)
except dns.resolver.NXDOMAIN:
flash(gettext('Error: Email invalid. The domain %(domain) does not have an MX record.', domain), 'danger')
flash(gettext('Error: Email invalid. The domain %(domain)s does not have an MX record.', domain=domain), 'danger')
return res(400)

user = User.find_by_email(db, email)
Expand Down Expand Up @@ -215,7 +215,7 @@ def res(code):

def try_subscribe(node):
if user in node.subscribed_users:
flash(gettext('Error: You are already subscribed to %(node)!', node), 'danger')
flash(gettext('Error: You are already subscribed to %(node)s!', node=node.name), 'danger')
return redirect_to_last_page()

s = Subscription()
Expand All @@ -226,7 +226,7 @@ def try_subscribe(node):
db.add(node) # node might not be in db yet
db.commit()

flash(gettext('Subscribed to node %(node).', node.name), 'success')
flash(gettext('Subscribed to node %(node)s.', node=node.name), 'success')
if request.args.get('goto') == 'yes':
return redirect(url_for('node', nodeid=node.nodeid))
else:
Expand All @@ -253,7 +253,7 @@ def try_subscribe(node):
node = nodes_json_cache.find_by_nodeid(request.args['nodeid'])

if not node:
flash(gettext('Error: Node with nodeid %(nodeid) not found!', request.args['nodeid']), 'danger')
flash(gettext('Error: Node with nodeid %(nodeid)s not found!', nodeid=request.args['nodeid']), 'danger')
return res(400)

return try_subscribe(node)
Expand All @@ -278,24 +278,24 @@ def unsubscribe():
node = nodeset.find_by_nodeid(request.args['nodeid'])

if not node:
flash(gettext('Error: Unsubscribe failed. Node with nodeid %(nodeid) not found!', request.args['nodeid']), 'danger')
flash(gettext('Error: Unsubscribe failed. Node with nodeid %(nodeid)s not found!', nodeid=request.args['nodeid']), 'danger')
return redirect_to_last_page()

subscription = node.get_subscription_by_user(db, user)

if not subscription:
flash(gettext('Error: Unsubscribe failed. You were not subscribed to %(node)!', node.name), 'danger')
flash(gettext('Error: Unsubscribe failed. You were not subscribed to %(node)s!', node=node.name), 'danger')
return redirect_to_last_page()

db.delete(subscription)
db.commit()

flash(gettext('Sucessfully unsubscribed from %(node)!', node.name), 'info')
flash(gettext('Sucessfully unsubscribed from %(node)s!', node=node.name), 'info')

if len(node.subscriptions) == 0:
db.delete(node)
db.commit()
flash(gettext('Node %(node) was removed, because nobody subscribes to it anymore.', node.name), 'info')
flash(gettext('Node %(node)s was removed, because nobody subscribes to it anymore.', node=node.name), 'info')

return redirect('/')

Expand Down