From 4178d1f7f623590a4a4fe99297cc9c35b92388ca Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Fri, 15 Oct 2021 14:10:34 -0700 Subject: [PATCH] Adds context to translation strings on discover page --- bookwyrm/templates/discover/card-header.html | 26 ++++++++++++++++++++ bookwyrm/templates/discover/large-book.html | 18 +------------- bookwyrm/templates/discover/small-book.html | 18 +------------- 3 files changed, 28 insertions(+), 34 deletions(-) create mode 100644 bookwyrm/templates/discover/card-header.html diff --git a/bookwyrm/templates/discover/card-header.html b/bookwyrm/templates/discover/card-header.html new file mode 100644 index 00000000..0eb9a678 --- /dev/null +++ b/bookwyrm/templates/discover/card-header.html @@ -0,0 +1,26 @@ +{% load i18n %} +{% load utilities %} + +{% with user_path=status.user.local_path username=status.user.display_name book_path=status.book.local_poth book_title=book|book_title %} + +{% if status.status_type == 'GeneratedNote' %} + {{ status.content|safe }} +{% elif status.status_type == 'Rating' %} + {% blocktrans trimmed %} + {{ username }} rated {{ book_title }} + {% endblocktrans %} +{% elif status.status_type == 'Review' %} + {% blocktrans trimmed %} + {{ username }} reviewed {{ book_title }} + {% endblocktrans %} +{% elif status.status_type == 'Comment' %} + {% blocktrans trimmed %} + {{ username }} commented on {{ book_title }} + {% endblocktrans %} +{% elif status.status_type == 'Quotation' %} + {% blocktrans trimmed %} + {{ username }} quoted {{ book_title }} + {% endblocktrans %} +{% endif %} + +{% endwith %} diff --git a/bookwyrm/templates/discover/large-book.html b/bookwyrm/templates/discover/large-book.html index 6d80c3da..1fa0afb9 100644 --- a/bookwyrm/templates/discover/large-book.html +++ b/bookwyrm/templates/discover/large-book.html @@ -36,23 +36,7 @@

- - {{ status.user.display_name }} - - - {% if status.status_type == 'GeneratedNote' %} - {{ status.content|safe }} - {% elif status.status_type == 'Rating' %} - {% trans "rated" %} - {% elif status.status_type == 'Review' %} - {% trans "reviewed" %} - {% elif status.status_type == 'Comment' %} - {% trans "commented on" %} - {% elif status.status_type == 'Quotation' %} - {% trans "quoted" %} - {% endif %} - - {{ book.title }} + {% include "discover/card-header.html" %}

diff --git a/bookwyrm/templates/discover/small-book.html b/bookwyrm/templates/discover/small-book.html index 5b207018..76732ca1 100644 --- a/bookwyrm/templates/discover/small-book.html +++ b/bookwyrm/templates/discover/small-book.html @@ -22,23 +22,7 @@

- - {{ status.user.display_name }} - - - {% if status.status_type == 'GeneratedNote' %} - {{ status.content|safe }} - {% elif status.status_type == 'Rating' %} - {% trans "rated" %} - {% elif status.status_type == 'Review' %} - {% trans "reviewed" %} - {% elif status.status_type == 'Comment' %} - {% trans "commented on" %} - {% elif status.status_type == 'Quotation' %} - {% trans "quoted" %} - {% endif %} - - {{ book.title }} + {% include "discover/card-header.html" %}

{% if status.rating %}