Add translatable strings support to dashboard app.

This commit is contained in:
Christopher C. Wells 2019-04-14 08:40:08 -07:00
parent d9ef3b868b
commit e20903c60b
15 changed files with 269 additions and 60 deletions

View File

@ -1,12 +1,13 @@
{% extends 'cards/base.html' %}
{% load i18n %}
{% block header %}Last Diaper Change{% endblock %}
{% block header %}{% trans "Last Diaper Change" %}{% endblock %}
{% block title %}
{% if change %}
{{ change.time|timesince }} ago
{% blocktrans %}{{ change.time|timesince }} ago{% endblocktrans %}
{% else %}
Never
{% trans "Never" %}
{% endif %}
{% endblock %}

View File

@ -1,9 +1,10 @@
{% extends 'cards/base.html' %}
{% load i18n %}
{% block header %}Diaper Changes{% endblock %}
{% block header %}{% trans "Diaper Changes" %}{% endblock %}
{% block title %}
Past Week
{% trans "Past Week" %}
{% endblock %}
{% block content %}
@ -14,23 +15,23 @@
{% if info.wet_pct > 0 %}
<div class="progress-bar bg-primary lead"
role="progressbar"
style="width: {{ info.wet_pct }}%;">{{ info.wet|floatformat:'0' }}&nbsp;wet</div>
style="width: {{ info.wet_pct }}%;">{{ info.wet|floatformat:'0' }}&nbsp;{% trans "wet" %}</div>
{% endif %}
{% if info.solid_pct > 0 %}
<div class="progress-bar bg-secondary lead"
role="progressbar"
style="width: {{ info.solid_pct }}%;">
{{ info.solid|floatformat:'0' }}&nbsp;solid</div>
{{ info.solid|floatformat:'0' }}&nbsp;{% trans "solid" %}</div>
{% endif %}
</div>
<div class="text-center text-light small">
{% if key == 0 %}
today
{% trans "today" %}
{% elif key == 1 %}
yesterday
{% trans "yesterday" %}
{% else %}
{{ key }} days ago
{% blocktrans %}{{ key }} days ago{% endblocktrans %}
{% endif %}
</div>
{% endif %}

View File

@ -1,12 +1,13 @@
{% extends 'cards/base.html' %}
{% load i18n %}
{% block header %}Last Feeding{% endblock %}
{% block header %}{% trans "Last Feeding" %}{% endblock %}
{% block title %}
{% if feeding %}
{{ feeding.end|timesince }} ago
{% blocktrans %}{{ feeding.end|timesince }} ago{% endblocktrans %}
{% else %}
Never
{% trans "Never" %}
{% endif %}
{% endblock %}

View File

@ -1,11 +1,12 @@
{% extends 'cards/base.html' %}
{% load i18n %}
{% block header %}Last Feeding Method{% endblock %}
{% block header %}{% trans "Last Feeding Method" %}{% endblock %}
{% block title %}
{% if feeding %}
<div class="display-4 text-center">{{ feeding.method }}</div>
{% else %}
None
{% trans "None" %}
{% endif %}
{% endblock %}

View File

@ -1,18 +1,20 @@
{% extends 'cards/base.html' %}
{% load duration %}
{% load duration i18n %}
{% block header %}Today's Sleep{% endblock %}
{% block header %}{% trans "Today's Sleep" %}{% endblock %}
{% block title %}
{% if total %}
{{ total|duration_string }}
{% else %}
<i class="icon icon-sad" aria-hidden="true"></i>
None yet today
{% trans "None yet today" %}
<i class="icon icon-sad" aria-hidden="true"></i>
{% endif %}
{% endblock %}
{% block content %}
{% if count > 0 %}{{ count }} sleep entries{% endif %}
{% if count > 0 %}
{% blocktrans %}{{ count }} sleep entries{% endblocktrans %}
{% endif %}
{% endblock %}

View File

@ -1,13 +1,13 @@
{% extends 'cards/base.html' %}
{% load duration %}
{% load duration i18n %}
{% block header %}Last Slept{% endblock %}
{% block header %}{% trans "Last Slept" %}{% endblock %}
{% block title %}
{% if sleep %}
{{ sleep.end|timesince }} ago
{% blocktrans %}{{ sleep.end|timesince }} ago{% endblocktrans %}
{% else %}
Never
{% trans "Never" %}
{% endif %}
{% endblock %}

View File

@ -1,14 +1,14 @@
{% extends 'cards/base.html' %}
{% load duration %}
{% load duration i18n %}
{% block header %}Today's Naps{% endblock %}
{% block header %}{% trans "Today's Naps" %}{% endblock %}
{% block title %}
{% if count %}
{{ count }} nap{{ count|pluralize }}
{% blocktrans %}{{ count }} nap{{ count|pluralize }}{% endblocktrans %}
{% else %}
<i class="icon icon-sad" aria-hidden="true"></i>
None yet today
{% trans "None yet today" %}
<i class="icon icon-sad" aria-hidden="true"></i>
{% endif %}
{% endblock %}

View File

@ -1,9 +1,9 @@
{% load duration %}
{% load duration i18n %}
<div class="card card-dashboard card-statistics">
<div class="card-header">
<i class="icon icon-graph pull-left" aria-hidden="true"></i>
Statistics
{% trans "Statistics" %}
</div>
<div class="card-body text-center">
<div id="statistics-carousel" class="carousel slide" data-interval="false">
@ -20,7 +20,7 @@
{{ stat.stat }}
{% endif %}
{% else %}
<em>Not enough data</em>
<em>{% trans "Not enough data" %}</em>
{% endif %}
</span>
<div class="card-text">{{ stat.title }}</div>
@ -29,11 +29,11 @@
</div>
<a class="carousel-control-prev" href="#statistics-carousel" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
<span class="sr-only">{% trans "Previous" %}</span>
</a>
<a class="carousel-control-next" href="#statistics-carousel" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
<span class="sr-only">{% trans "Next" %}</span>
</a>
</div>
</div>

View File

@ -1,10 +1,11 @@
{% extends 'cards/base.html' %}
{% load i18n %}
{% block header %}Active Timers{% endblock %}
{% block header %}{% trans "Active Timers" %}{% endblock %}
{% block title %}
{% with instances|length as count %}
{{ count }} active timer{{ count|pluralize }}
{% blocktrans %}{{ count }} active timer{{ count|pluralize }}{% endblocktrans %}
{% endwith %}
{% endblock %}
@ -13,7 +14,10 @@
{% for instance in instances %}
<a href="{% url 'core:timer-detail' instance.id %}"
class="list-group-item list-group-item-action">
<strong>{{ instance }}</strong> <p class="text-muted small m-0">Started by {{ instance.user }} at {{ instance.start|time }}</p>
<strong>{{ instance }}</strong>
<p class="text-muted small m-0">
{% blocktrans %}Started by {{ instance.user }} at {{ instance.start|time }}{% endblocktrans %}
</p>
</a>
{% endfor %}
</ul>

View File

@ -1,14 +1,14 @@
{% extends 'cards/base.html' %}
{% load duration %}
{% load duration i18n %}
{% block header %}Today's Tummy Time{% endblock %}
{% block header %}{% trans "Today's Tummy Time" %}{% endblock %}
{% block title %}
{% if stats.count > 0 %}
{{ stats.total|duration_string }}
{% else %}
<i class="icon icon-sad" aria-hidden="true"></i>
None yet today
{% trans "None yet today" %}
<i class="icon icon-sad" aria-hidden="true"></i>
{% endif %}
{% endblock %}
@ -16,7 +16,9 @@
{% block listgroup %}
<ul class="list-group list-group-flush text-muted small">
{% for instance in instances %}
<li class="list-group-item">{{ instance.duration|duration_string }} at {{ instance.end|time }}</li>
<li class="list-group-item">
{% blocktrans %}{{ instance.duration|duration_string }} at {{ instance.end|time }}{% endblocktrans %}
</li>
{% endfor %}
</ul>
{% endblock %}

View File

@ -1,13 +1,13 @@
{% extends 'cards/base.html' %}
{% load duration %}
{% load duration i18n %}
{% block header %}Last Tummy Time{% endblock %}
{% block header %}{% trans "Last Tummy Time" %}{% endblock %}
{% block title %}
{% if tummytime %}
{{ tummytime.time|timesince }} ago
{% blocktrans %}{{ tummytime.time|timesince }} ago{% endblocktrans %}
{% else %}
Never
{% trans "Never" %}
{% endif %}
{% endblock %}

View File

@ -1,12 +1,12 @@
{% extends 'babybuddy/page.html' %}
{% load cards %}
{% load cards i18n %}
{% block title %}Dashboard - {{ object }}{% endblock %}
{% block title %}{% trans "Dashboard" %} - {{ object }}{% endblock %}
{% block breadcrumbs %}
<li class="breadcrumb-item"><a href="{% url 'core:child-list' %}">Children</a></li>
<li class="breadcrumb-item"><a href="{% url 'core:child-list' %}">{% trans "Children" %}</a></li>
<li class="breadcrumb-item font-weight-bold"><a href="{% url 'core:child' object.slug %}">{{ object }}</a></li>
<li class="breadcrumb-item active" aria-current="page">Dashboard</li>
<li class="breadcrumb-item active" aria-current="page">{% trans "Dashboard" %}</li>
{% endblock %}
{% block content %}

View File

@ -1,4 +1,6 @@
<div class="child-actions btn-group btn-group-lg center-block" role="group" aria-label="Child actions">
{% load i18n %}
<div class="child-actions btn-group btn-group-lg center-block" role="group" aria-label="{% trans "Child actions" %}">
{% if perms.core.view_child %}
<a href="{% url 'dashboard:dashboard-child' object.slug %}" class="btn btn-success">
@ -14,12 +16,12 @@
aria-haspopup="true"
aria-expanded="false"><i class="icon icon-graph" aria-hidden="true"></i></button>
<div class="dropdown-menu" aria-labelledby="reports-dropdown">
<a class="dropdown-item" href="{% url 'reports:report-diaperchange-types-child' object.slug %}">Diaper Change Types</a>
<a class="dropdown-item" href="{% url 'reports:report-diaperchange-lifetimes-child' object.slug %}">Diaper Lifetimes</a>
<a class="dropdown-item" href="{% url 'reports:report-feeding-duration-child' object.slug %}">Feeding Durations (Average)</a>
<a class="dropdown-item" href="{% url 'reports:report-sleep-pattern-child' object.slug %}">Sleep Pattern</a>
<a class="dropdown-item" href="{% url 'reports:report-sleep-totals-child' object.slug %}">Sleep Totals</a>
<a class="dropdown-item" href="{% url 'reports:report-weight-weight-child' object.slug %}">Weight</a>
<a class="dropdown-item" href="{% url 'reports:report-diaperchange-types-child' object.slug %}">{% trans "Diaper Change Types" %}</a>
<a class="dropdown-item" href="{% url 'reports:report-diaperchange-lifetimes-child' object.slug %}">{% trans "Diaper Lifetimes" %}</a>
<a class="dropdown-item" href="{% url 'reports:report-feeding-duration-child' object.slug %}">{% trans "Feeding Durations (Average)" %}</a>
<a class="dropdown-item" href="{% url 'reports:report-sleep-pattern-child' object.slug %}">{% trans "Sleep Pattern" %}</a>
<a class="dropdown-item" href="{% url 'reports:report-sleep-totals-child' object.slug %}">{% trans "Sleep Totals" %}</a>
<a class="dropdown-item" href="{% url 'reports:report-weight-weight-child' object.slug %}">{% trans "Weight" %}</a>
</div>
</div>

View File

@ -1,10 +1,10 @@
{% extends 'babybuddy/page.html' %}
{% load static thumbnail %}
{% load i18n static thumbnail %}
{% block title %}Dashboard{% endblock %}
{% block title %}{% trans "Dashboard" %}{% endblock %}
{% block breadcrumbs %}
<li class="breadcrumb-item font-weight-bold">Dashboard</li>
<li class="breadcrumb-item font-weight-bold">{% trans "Dashboard" %}</li>
{% endblock %}
{% block content %}
@ -24,8 +24,8 @@
<h4 class="card-title">{{ object }}</h4>
<div class="card-text">
<p class="lead">
Born <span class="text-secondary">{{ object.birth_date }}</span><br/>
Age <span class="text-secondary">{{ object.birth_date|timesince }}</span>
{% trans "Born" %} <span class="text-secondary">{{ object.birth_date }}</span><br/>
{% trans "Age" %} <span class="text-secondary">{{ object.birth_date|timesince }}</span>
</p>
{% include 'dashboard/child_button_group.html' %}
</div>

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-04-13 22:41-0700\n"
"POT-Creation-Date: 2019-04-14 08:38-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -26,6 +26,10 @@ msgstr "Paramètres"
#: .\babybuddy\admin.py:16 .\babybuddy\templates\babybuddy\nav-dropdown.html:76
#: .\babybuddy\templates\babybuddy\user_settings_form.html:63
#: .\dashboard\templates\dashboard\child.html:4
#: .\dashboard\templates\dashboard\child.html:9
#: .\dashboard\templates\dashboard\dashboard.html:4
#: .\dashboard\templates\dashboard\dashboard.html:7
msgid "Dashboard"
msgstr "Tableau de bord"
@ -174,6 +178,7 @@ msgstr "Heure de Ventre"
#: .\core\templates\core\weight_list.html:4
#: .\core\templates\core\weight_list.html:7
#: .\core\templates\core\weight_list.html:18
#: .\dashboard\templates\dashboard\child_button_group.html:24
msgid "Weight"
msgstr "Poids"
@ -184,6 +189,7 @@ msgstr "Poids"
#: .\core\templates\core\child_form.html:13
#: .\core\templates\core\child_list.html:4
#: .\core\templates\core\child_list.html:7
#: .\dashboard\templates\dashboard\child.html:7
msgid "Children"
msgstr "Enfants"
@ -291,12 +297,14 @@ msgstr "Tchat / Support"
#: .\babybuddy\templates\babybuddy\paginator.html:11
#: .\core\templates\core\child_detail.html:34
#: .\core\templates\core\child_detail.html:36
#: .\dashboard\templates\cards\statistics.html:32
msgid "Previous"
msgstr "Précédente"
#: .\babybuddy\templates\babybuddy\paginator.html:28
#: .\core\templates\core\child_detail.html:41
#: .\core\templates\core\child_detail.html:43
#: .\dashboard\templates\cards\statistics.html:36
msgid "Next"
msgstr "Suivante"
@ -491,6 +499,7 @@ msgstr ""
#: .\core\templates\core\diaperchange_list.html:4
#: .\core\templates\core\diaperchange_list.html:7
#: .\core\templates\core\diaperchange_list.html:11
#: .\dashboard\templates\cards\diaperchange_types.html:4
msgid "Diaper Changes"
msgstr "Changement"
@ -718,10 +727,12 @@ msgid "To confirm this action. Type the full name of the child below."
msgstr ""
#: .\core\templates\core\child_detail.html:23
#: .\dashboard\templates\dashboard\dashboard.html:27
msgid "Born"
msgstr ""
#: .\core\templates\core\child_detail.html:24
#: .\dashboard\templates\dashboard\dashboard.html:28
msgid "Age"
msgstr ""
@ -960,12 +971,14 @@ msgid "View Timers"
msgstr ""
#: .\core\templates\core\timer_nav.html:27
#: .\dashboard\templates\cards\timer_list.html:4
#, fuzzy
#| msgid "Activities"
msgid "Active Timers"
msgstr "Activités"
#: .\core\templates\core\timer_nav.html:31
#: .\dashboard\templates\cards\feeding_last_method.html:10
msgid "None"
msgstr ""
@ -1051,3 +1064,185 @@ msgstr "Utilisateur %(username)s ajouté!"
#, python-format
msgid "%(timer)s stopped."
msgstr ""
#: .\dashboard\templates\cards\diaperchange_last.html:4
#, fuzzy
#| msgid "Diaper Change"
msgid "Last Diaper Change"
msgstr "Changement"
#: .\dashboard\templates\cards\diaperchange_last.html:8
#, python-format
msgid "%(change.time|timesince)s ago"
msgstr ""
#: .\dashboard\templates\cards\diaperchange_last.html:10
#: .\dashboard\templates\cards\feeding_last.html:10
#: .\dashboard\templates\cards\sleep_last.html:10
#: .\dashboard\templates\cards\tummytime_last.html:10
msgid "Never"
msgstr ""
#: .\dashboard\templates\cards\diaperchange_types.html:7
msgid "Past Week"
msgstr ""
#: .\dashboard\templates\cards\diaperchange_types.html:18
#, fuzzy
#| msgid "Weight"
msgid "wet"
msgstr "Poids"
#: .\dashboard\templates\cards\diaperchange_types.html:25
msgid "solid"
msgstr ""
#: .\dashboard\templates\cards\diaperchange_types.html:30
msgid "today"
msgstr ""
#: .\dashboard\templates\cards\diaperchange_types.html:32
msgid "yesterday"
msgstr ""
#: .\dashboard\templates\cards\diaperchange_types.html:34
#, python-format
msgid "%(key)s days ago"
msgstr ""
#: .\dashboard\templates\cards\feeding_last.html:4
#, fuzzy
#| msgid "Feeding"
msgid "Last Feeding"
msgstr "Allaitement"
#: .\dashboard\templates\cards\feeding_last.html:8
#, python-format
msgid "%(feeding.end|timesince)s ago"
msgstr ""
#: .\dashboard\templates\cards\feeding_last_method.html:4
msgid "Last Feeding Method"
msgstr ""
#: .\dashboard\templates\cards\sleep_day.html:4
msgid "Today's Sleep"
msgstr ""
#: .\dashboard\templates\cards\sleep_day.html:11
#: .\dashboard\templates\cards\sleep_naps_day.html:11
#: .\dashboard\templates\cards\tummytime_day.html:11
msgid "None yet today"
msgstr ""
#: .\dashboard\templates\cards\sleep_day.html:18
#, fuzzy, python-format
#| msgid "No users found."
msgid "%(count)s sleep entries"
msgstr "Aucun utilisateur trouvé."
#: .\dashboard\templates\cards\sleep_last.html:4
#, fuzzy
#| msgid "Last Name"
msgid "Last Slept"
msgstr "Nom"
#: .\dashboard\templates\cards\sleep_last.html:8
#, python-format
msgid "%(sleep.end|timesince)s ago"
msgstr ""
#: .\dashboard\templates\cards\sleep_naps_day.html:4
msgid "Today's Naps"
msgstr ""
#: .\dashboard\templates\cards\sleep_naps_day.html:8
#, python-format
msgid "%(count)s nap%(count|pluralize)s"
msgstr ""
#: .\dashboard\templates\cards\statistics.html:6
msgid "Statistics"
msgstr ""
#: .\dashboard\templates\cards\statistics.html:23
msgid "Not enough data"
msgstr ""
#: .\dashboard\templates\cards\timer_list.html:8
#, python-format
msgid "%(count)s active timer%(count|pluralize)s"
msgstr ""
#: .\dashboard\templates\cards\timer_list.html:19
#, python-format
msgid "Started by %(instance.user)s at %(instance.start|time)s"
msgstr ""
#: .\dashboard\templates\cards\tummytime_day.html:4
#, fuzzy
#| msgid "Tummy Time"
msgid "Today's Tummy Time"
msgstr "Heure de Ventre"
#: .\dashboard\templates\cards\tummytime_day.html:20
#, python-format
msgid "%(instance.duration|duration_string)s at %(instance.end|time)s"
msgstr ""
#: .\dashboard\templates\cards\tummytime_last.html:4
#, fuzzy
#| msgid "Tummy Time"
msgid "Last Tummy Time"
msgstr "Heure de Ventre"
#: .\dashboard\templates\cards\tummytime_last.html:8
#, python-format
msgid "%(tummytime.time|timesince)s ago"
msgstr ""
#: .\dashboard\templates\dashboard\child_button_group.html:3
#, fuzzy
#| msgid "Actions"
msgid "Child actions"
msgstr "Opérations"
#: .\dashboard\templates\dashboard\child_button_group.html:19
#, fuzzy
#| msgid "Diaper Changes"
msgid "Diaper Change Types"
msgstr "Changement"
#: .\dashboard\templates\dashboard\child_button_group.html:20
#, fuzzy
#| msgid "Diaper Changes"
msgid "Diaper Lifetimes"
msgstr "Changement"
#: .\dashboard\templates\dashboard\child_button_group.html:21
msgid "Feeding Durations (Average)"
msgstr ""
#: .\dashboard\templates\dashboard\child_button_group.html:22
#, fuzzy
#| msgid "Sleep entry"
msgid "Sleep Pattern"
msgstr "Annotation de sommeil"
#: .\dashboard\templates\dashboard\child_button_group.html:23
#, fuzzy
#| msgid "Sleep entry"
msgid "Sleep Totals"
msgstr "Annotation de sommeil"
#, fuzzy
#~| msgid "<h1>Update <span class=\"text-info\">%(object)s</span></h1>"
#~ msgid ""
#~ "Born <span class=\"text-secondary\">%(object.birth_date)s</span><br/>"
#~ msgstr "<h1>Mettre à jour <span class=\"text-info\">%(object)s</span></h1>"
#, fuzzy
#~| msgid "<h1>Update <span class=\"text-info\">%(object)s</span></h1>"
#~ msgid ""
#~ "Age <span class=\"text-secondary\">%(object.birth_date|timesince)s</span>"
#~ msgstr "<h1>Mettre à jour <span class=\"text-info\">%(object)s</span></h1>"