From 142bcbbb77044ce59e9880561a9e744acfa59a79 Mon Sep 17 00:00:00 2001 From: Timo Ludwig Date: Sun, 26 Feb 2023 16:39:31 +0100 Subject: [PATCH] Make dashboard status messages translatable --- linkcheck/locale/de/LC_MESSAGES/django.po | 40 +++++++++++++++-------- linkcheck/views.py | 14 +++++--- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/linkcheck/locale/de/LC_MESSAGES/django.po b/linkcheck/locale/de/LC_MESSAGES/django.po index a0d4c2e..32a6ca8 100644 --- a/linkcheck/locale/de/LC_MESSAGES/django.po +++ b/linkcheck/locale/de/LC_MESSAGES/django.po @@ -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." diff --git a/linkcheck/views.py b/linkcheck/views.py index 9ab2add..063c6df 100644 --- a/linkcheck/views.py +++ b/linkcheck/views.py @@ -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 ( - "We've found {} broken link{}.
" - "View/fix broken links".format( - broken_links, - "s" if broken_links > 1 else "", + "{}
{}".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):