mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 03:21:05 +00:00
Merge pull request #2789 from bpeel/translatable-shelf-name
Fix two places where the reading status shelf name wasn’t translated
This commit is contained in:
commit
fadbc76aaa
2 changed files with 16 additions and 10 deletions
|
@ -4,6 +4,7 @@
|
||||||
{% load humanize %}
|
{% load humanize %}
|
||||||
{% load utilities %}
|
{% load utilities %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
{% load shelf_tags %}
|
||||||
|
|
||||||
{% block title %}{{ book|book_title }}{% endblock %}
|
{% block title %}{{ book|book_title }}{% endblock %}
|
||||||
|
|
||||||
|
@ -245,7 +246,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
{% for shelf in user_shelfbooks %}
|
{% for shelf in user_shelfbooks %}
|
||||||
<li class="box">
|
<li class="box">
|
||||||
<a href="{{ shelf.shelf.local_path }}">{{ shelf.shelf.name }}</a>
|
<a href="{{ shelf.shelf.local_path }}">{{ shelf.shelf|translate_shelf_name }}</a>
|
||||||
<div class="is-pulled-right">
|
<div class="is-pulled-right">
|
||||||
{% include 'snippets/shelf_selector.html' with shelf=shelf.shelf class="is-small" readthrough=readthrough %}
|
{% include 'snippets/shelf_selector.html' with shelf=shelf.shelf class="is-small" readthrough=readthrough %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,6 +9,15 @@ from bookwyrm.utils import cache
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
|
|
||||||
|
SHELF_NAMES = {
|
||||||
|
"all": _("All books"),
|
||||||
|
"to-read": _("To Read"),
|
||||||
|
"reading": _("Currently Reading"),
|
||||||
|
"read": _("Read"),
|
||||||
|
"stopped-reading": _("Stopped Reading"),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@register.filter(name="is_book_on_shelf")
|
@register.filter(name="is_book_on_shelf")
|
||||||
def get_is_book_on_shelf(book, shelf):
|
def get_is_book_on_shelf(book, shelf):
|
||||||
"""is a book on a shelf"""
|
"""is a book on a shelf"""
|
||||||
|
@ -42,15 +51,11 @@ def get_translated_shelf_name(shelf):
|
||||||
return ""
|
return ""
|
||||||
# support obj or dict
|
# support obj or dict
|
||||||
identifier = shelf["identifier"] if isinstance(shelf, dict) else shelf.identifier
|
identifier = shelf["identifier"] if isinstance(shelf, dict) else shelf.identifier
|
||||||
if identifier == "all":
|
|
||||||
return _("All books")
|
try:
|
||||||
if identifier == "to-read":
|
return SHELF_NAMES[identifier]
|
||||||
return _("To Read")
|
except KeyError:
|
||||||
if identifier == "reading":
|
return shelf["name"] if isinstance(shelf, dict) else shelf.name
|
||||||
return _("Currently Reading")
|
|
||||||
if identifier == "read":
|
|
||||||
return _("Read")
|
|
||||||
return shelf["name"] if isinstance(shelf, dict) else shelf.name
|
|
||||||
|
|
||||||
|
|
||||||
@register.simple_tag(takes_context=True)
|
@register.simple_tag(takes_context=True)
|
||||||
|
|
Loading…
Reference in a new issue