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> </dl>
<ul> <ul>
{% if readthrough.finish_date or readthrough.progress %} {% 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 %} <li>
{% else %}{{ readthrough.progress }}%{% endif %}{% endif %} {% 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 %} {% if readthrough.progress %}
{% trans "Show all updates" as button_text %} {% 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" %} {% 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 %} {% csrf_token %}
{{ progress_update.created_date | naturalday }}: {{ progress_update.created_date | naturalday }}:
{% if progress_update.mode == 'PG' %} {% 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 %} {% else %}
{{ progress_update.progress }}% {{ progress_update.progress }}%
{% endif %} {% endif %}