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 Mar 19, 2023
1 parent d2c152e commit 34ff052
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
24 changes: 19 additions & 5 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-28 23:01+0100\n"
"POT-Creation-Date: 2023-03-19 14:38+0100\n"
"Language: German\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -210,19 +210,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"

Expand Down Expand Up @@ -268,5 +268,19 @@ msgstr "Nicht ignorieren"
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."

#~ msgid "Link to section on same page"
#~ msgstr "Link zu Abschnitt auf derselben Seite"
14 changes: 9 additions & 5 deletions linkcheck/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 34ff052

Please sign in to comment.