i18n for "page x of y"

This commit is contained in:
Mouse Reeve 2021-04-01 20:22:42 -07:00
parent 34a32032c9
commit fdfbf29744
2 changed files with 20 additions and 3 deletions

View file

@ -0,0 +1,7 @@
{% load humanize %}
{% load i18n %}
{% if total_pages %}
{% blocktrans with page=page|intcomma total_pages=total_pages|intcomma %}page {{ page }} of {{ total_pages }}{% endblocktrans %}
{% else %}
{% blocktrans with page=page|intcomma %}page {{ page }}{% endblocktrans %}
{% endif %}

View file

@ -9,8 +9,18 @@
</dl>
<ul>
{% if readthrough.finish_date or readthrough.progress %}
<li>{% if readthrough.finish_date %} {{ readthrough.finish_date | localtime | naturalday }}: {% trans "finished" %} {% else %}{% if readthrough.progress_mode == 'PG' %}on page {{ readthrough.progress }}{% if book.pages %} of {{ book.pages }}{% endif %}
{% else %}{{ readthrough.progress }}%{% endif %}{% endif %}
<li>
{% if readthrough.finish_date %}
{{ readthrough.finish_date | localtime | naturalday }}: {% trans "finished" %}
{% else %}
{% if readthrough.progress_mode == 'PG' %}
{% include 'snippets/page_text.html' with page=readthrough.progress total_pages=book.pages %}
{% else %}
{{ readthrough.progress }}%
{% endif %}
{% endif %}
{% if readthrough.progress %}
{% trans "Show all updates" as button_text %}
{% include 'snippets/toggle/toggle_button.html' with text=button_text controls_text="updates" controls_uid=readthrough.id class="is-small" %}
@ -21,7 +31,7 @@
{% csrf_token %}
{{ progress_update.created_date | naturalday }}:
{% if progress_update.mode == 'PG' %}
page {{ progress_update.progress }} of {{ book.pages }}
{% include 'snippets/page_text.html' with page=progress_update.progress total_pages=book.pages %}
{% else %}
{{ progress_update.progress }}%
{% endif %}