Skip to content

Commit

Permalink
Make dashboard status messages translatable
Browse files Browse the repository at this point in the history
  • Loading branch information
timobrembeck committed Feb 27, 2023
1 parent a261868 commit 142bcbb
Showing 2 changed files with 36 additions and 18 deletions.
40 changes: 27 additions & 13 deletions linkcheck/locale/de/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-02-22 22:35+0100\n"
"POT-Creation-Date: 2023-02-26 16:43+0100\n"
"Language: German\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -53,35 +53,35 @@ msgstr[0] ""
msgstr[1] ""
"Das Löschen von {} hat dazu geführt, dass {} Links nicht mehr funktionieren."

#: models.py:111
#: models.py:113
msgid "Working empty anchor"
msgstr "Funktionierender leerer Anker"

#: models.py:113
#: models.py:115
msgid "Anchor could not be checked"
msgstr "Anker konnte nicht geprüft werden"

#: models.py:115
#: models.py:117
msgid "Broken anchor"
msgstr "Ungültiger Anker"

#: models.py:116
#: models.py:118
msgid "Working anchor"
msgstr "Funktionierender Anker"

#: models.py:123
#: models.py:125
msgid "Insecure link"
msgstr "Unsicherer Link"

#: models.py:125
#: models.py:127
msgid "SSL certificate could not be checked"
msgstr "SSL-Zertifikat konnte nicht überprüft werden"

#: models.py:127
#: models.py:129
msgid "Broken SSL certificate"
msgstr "Fehlerhaftes SSL-Zertifikat"

#: models.py:128
#: models.py:130
msgid "Valid SSL certificate"
msgstr "Valides SSL-Zertifikat"

@@ -142,19 +142,19 @@ msgstr "Letze"
msgid "Show"
msgstr "Anzeigen"

#: templates/linkcheck/report.html:126 views.py:83
#: templates/linkcheck/report.html:126 views.py:85
msgid "Valid links"
msgstr "Gültige Links"

#: templates/linkcheck/report.html:127 views.py:92
#: templates/linkcheck/report.html:127 views.py:94
msgid "Broken links"
msgstr "Ungültige Links"

#: templates/linkcheck/report.html:128 views.py:86
#: templates/linkcheck/report.html:128 views.py:88
msgid "Untested links"
msgstr "Ungetestete Links"

#: templates/linkcheck/report.html:129 views.py:89
#: templates/linkcheck/report.html:129 views.py:91
msgid "Ignored links"
msgstr "Ignorierte Links"

@@ -199,3 +199,17 @@ msgstr "Nicht ignorieren"
#: templates/linkcheck/report.html:173
msgid "Redirects to"
msgstr "Leitet weiter zu"

#: views.py:175
msgid "We've found {} broken link."
msgid_plural "We've found {} broken links."
msgstr[0] "Es wurde {} ungültiger Link gefunden."
msgstr[1] "Es wurden {} ungültige Links gefunden."

#: views.py:180
msgid "View/fix broken links"
msgstr "Ungültige Links anzeigen/beheben"

#: views.py:186
msgid "Still checking. Please refresh this page in a short while."
msgstr "Es wird noch geprüft. Bitte aktualisieren Sie diese Seite später."
14 changes: 9 additions & 5 deletions linkcheck/views.py
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@
from django.templatetags.static import static
from django.urls import NoReverseMatch, reverse
from django.utils.translation import gettext as _
from django.utils.translation import ngettext

from linkcheck.linkcheck_settings import RESULTS_PER_PAGE
from linkcheck.models import Link
@@ -169,17 +170,20 @@ def get_status_message():
broken_links = Link.objects.filter(ignore=False, url__status=False).count()
if broken_links:
return (
"<span style='color: red;'>We've found {} broken link{}.</span><br>"
"<a href='{}'>View/fix broken links</a>".format(
broken_links,
"s" if broken_links > 1 else "",
"<span style='color: red;'>{}</span><br><a href='{}'>{}</a>".format(
ngettext(
"We've found {} broken link.",
"We've found {} broken links.",
broken_links
).format(broken_links),
reverse('linkcheck_report'),
_('View/fix broken links'),
)
)
else:
return ''
except DBMutexError:
return 'Still checking. Please refresh this page in a short while.'
return _('Still checking. Please refresh this page in a short while.')


def is_ajax(request):

0 comments on commit 142bcbb

Please sign in to comment.