Add translateable strings support in core app.

This commit is contained in:
Christopher C. Wells 2019-04-13 22:51:44 -07:00
parent c36451fc8e
commit bd4705b77f
30 changed files with 318 additions and 261 deletions

View File

@ -1,7 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django import forms from django import forms
from django.utils import timezone
from django.conf import settings from django.conf import settings
from django.utils import timezone
from django.utils.translation import gettext as _
from core import models from core import models
@ -77,7 +78,7 @@ class ChildDeleteForm(forms.ModelForm):
confirm_name = self.cleaned_data['confirm_name'] confirm_name = self.cleaned_data['confirm_name']
if confirm_name != str(self.instance): if confirm_name != str(self.instance):
raise forms.ValidationError( raise forms.ValidationError(
'Name does not match child name.', code='confirm_mismatch') _('Name does not match child name.'), code='confirm_mismatch')
return confirm_name return confirm_name
def save(self, commit=True): def save(self, commit=True):

View File

@ -6,6 +6,7 @@ from django.core.exceptions import ValidationError
from django.db import models from django.db import models
from django.template.defaultfilters import slugify from django.template.defaultfilters import slugify
from django.utils import timezone from django.utils import timezone
from django.utils.translation import gettext_lazy as _
def validate_date(date, field_name): def validate_date(date, field_name):
@ -17,7 +18,7 @@ def validate_date(date, field_name):
""" """
if date and date > timezone.localdate(): if date and date > timezone.localdate():
raise ValidationError( raise ValidationError(
{field_name: 'Date can not be in the future.'}, {field_name: _('Date can not be in the future.')},
code='date_invalid') code='date_invalid')
@ -31,10 +32,10 @@ def validate_duration(model, max_duration=timedelta(hours=24)):
if model.start and model.end: if model.start and model.end:
if model.start > model.end: if model.start > model.end:
raise ValidationError( raise ValidationError(
'Start time must come before end time.', _('Start time must come before end time.'),
code='end_before_start') code='end_before_start')
if model.end - model.start > max_duration: if model.end - model.start > max_duration:
raise ValidationError('Duration too long.', code='max_duration') raise ValidationError(_('Duration too long.'), code='max_duration')
def validate_unique_period(queryset, model): def validate_unique_period(queryset, model):
@ -50,7 +51,7 @@ def validate_unique_period(queryset, model):
if model.start and model.end: if model.start and model.end:
if queryset.filter(start__lte=model.end, end__gte=model.start): if queryset.filter(start__lte=model.end, end__gte=model.start):
raise ValidationError( raise ValidationError(
'Another entry intersects the specified time period.', _('Another entry intersects the specified time period.'),
code='period_intersection') code='period_intersection')
@ -63,7 +64,7 @@ def validate_time(time, field_name):
""" """
if time and time > timezone.localtime(): if time and time > timezone.localtime():
raise ValidationError( raise ValidationError(
{field_name: 'Date/time can not be in the future.'}, {field_name: _('Date/time can not be in the future.')},
code='time_invalid') code='time_invalid')
@ -84,7 +85,8 @@ class Child(models.Model):
class Meta: class Meta:
default_permissions = ('view', 'add', 'change', 'delete') default_permissions = ('view', 'add', 'change', 'delete')
ordering = ['last_name', 'first_name'] ordering = ['last_name', 'first_name']
verbose_name_plural = 'Children' verbose_name = _('Child')
verbose_name_plural = _('Children')
def __str__(self): def __str__(self):
return '{} {}'.format(self.first_name, self.last_name) return '{} {}'.format(self.first_name, self.last_name)
@ -103,15 +105,19 @@ class Child(models.Model):
class DiaperChange(models.Model): class DiaperChange(models.Model):
model_name = 'diaperchange' model_name = 'diaperchange'
child = models.ForeignKey( child = models.ForeignKey(
'Child', related_name='diaper_change', on_delete=models.CASCADE) 'Child',
on_delete=models.CASCADE,
related_name='diaper_change',
verbose_name=_('Child')
)
time = models.DateTimeField(blank=False, null=False) time = models.DateTimeField(blank=False, null=False)
wet = models.BooleanField() wet = models.BooleanField()
solid = models.BooleanField() solid = models.BooleanField()
color = models.CharField(max_length=255, blank=True, choices=[ color = models.CharField(max_length=255, blank=True, choices=[
('black', 'Black'), ('black', _('Black')),
('brown', 'Brown'), ('brown', _('Brown')),
('green', 'Green'), ('green', _('Green')),
('yellow', 'Yellow'), ('yellow', _('Yellow')),
]) ])
objects = models.Manager() objects = models.Manager()
@ -119,6 +125,8 @@ class DiaperChange(models.Model):
class Meta: class Meta:
default_permissions = ('view', 'add', 'change', 'delete') default_permissions = ('view', 'add', 'change', 'delete')
ordering = ['-time'] ordering = ['-time']
verbose_name = _('Diaper Change')
verbose_name_plural = _('Diaper Changes')
def __str__(self): def __str__(self):
return 'Diaper Change' return 'Diaper Change'
@ -139,24 +147,28 @@ class DiaperChange(models.Model):
# One or both of Wet and Solid is required. # One or both of Wet and Solid is required.
if not self.wet and not self.solid: if not self.wet and not self.solid:
raise ValidationError( raise ValidationError(
'Wet and/or solid is required.', code='wet_or_solid') _('Wet and/or solid is required.'), code='wet_or_solid')
class Feeding(models.Model): class Feeding(models.Model):
model_name = 'feeding' model_name = 'feeding'
child = models.ForeignKey( child = models.ForeignKey(
'Child', related_name='feeding', on_delete=models.CASCADE) 'Child',
on_delete=models.CASCADE,
related_name='feeding',
verbose_name=_('Child')
)
start = models.DateTimeField(blank=False, null=False) start = models.DateTimeField(blank=False, null=False)
end = models.DateTimeField(blank=False, null=False) end = models.DateTimeField(blank=False, null=False)
duration = models.DurationField(null=True, editable=False) duration = models.DurationField(null=True, editable=False)
type = models.CharField(max_length=255, choices=[ type = models.CharField(max_length=255, choices=[
('breast milk', 'Breast milk'), ('breast milk', _('Breast milk')),
('formula', 'Formula'), ('formula', _('Formula')),
]) ])
method = models.CharField(max_length=255, choices=[ method = models.CharField(max_length=255, choices=[
('bottle', 'Bottle'), ('bottle', _('Bottle')),
('left breast', 'Left breast'), ('left breast', _('Left breast')),
('right breast', 'Right breast'), ('right breast', _('Right breast')),
]) ])
amount = models.FloatField(blank=True, null=True) amount = models.FloatField(blank=True, null=True)
@ -165,6 +177,8 @@ class Feeding(models.Model):
class Meta: class Meta:
default_permissions = ('view', 'add', 'change', 'delete') default_permissions = ('view', 'add', 'change', 'delete')
ordering = ['-start'] ordering = ['-start']
verbose_name = _('Feeding')
verbose_name_plural = _('Feedings')
def __str__(self): def __str__(self):
return 'Feeding' return 'Feeding'
@ -184,14 +198,18 @@ class Feeding(models.Model):
if self.type == 'formula'and self.method != 'bottle': if self.type == 'formula'and self.method != 'bottle':
raise ValidationError( raise ValidationError(
{'method': {'method':
'Only "Bottle" method is allowed with "Formula" type.'}, _('Only "Bottle" method is allowed with "Formula" type.')},
code='bottle_formula_mismatch') code='bottle_formula_mismatch')
class Note(models.Model): class Note(models.Model):
model_name = 'note' model_name = 'note'
child = models.ForeignKey( child = models.ForeignKey(
'Child', related_name='note', on_delete=models.CASCADE) 'Child',
on_delete=models.CASCADE,
related_name='note',
verbose_name=_('Child')
)
note = models.TextField() note = models.TextField()
time = models.DateTimeField(auto_now=True) time = models.DateTimeField(auto_now=True)
@ -200,6 +218,8 @@ class Note(models.Model):
class Meta: class Meta:
default_permissions = ('view', 'add', 'change', 'delete') default_permissions = ('view', 'add', 'change', 'delete')
ordering = ['-time'] ordering = ['-time']
verbose_name = _('Note')
verbose_name_plural = _('Notes')
def __str__(self): def __str__(self):
return 'Note' return 'Note'
@ -214,7 +234,11 @@ class NapsManager(models.Manager):
class Sleep(models.Model): class Sleep(models.Model):
model_name = 'sleep' model_name = 'sleep'
child = models.ForeignKey( child = models.ForeignKey(
'Child', related_name='sleep', on_delete=models.CASCADE) 'Child',
on_delete=models.CASCADE,
related_name='sleep',
verbose_name=_('Child')
)
start = models.DateTimeField(blank=False, null=False) start = models.DateTimeField(blank=False, null=False)
end = models.DateTimeField(blank=False, null=False) end = models.DateTimeField(blank=False, null=False)
duration = models.DurationField(null=True, editable=False) duration = models.DurationField(null=True, editable=False)
@ -225,7 +249,8 @@ class Sleep(models.Model):
class Meta: class Meta:
default_permissions = ('view', 'add', 'change', 'delete') default_permissions = ('view', 'add', 'change', 'delete')
ordering = ['-start'] ordering = ['-start']
verbose_name_plural = 'Sleep' verbose_name = _('Sleep')
verbose_name_plural = _('Sleep')
def __str__(self): def __str__(self):
return 'Sleep' return 'Sleep'
@ -257,7 +282,7 @@ class Timer(models.Model):
start = models.DateTimeField( start = models.DateTimeField(
default=timezone.now, default=timezone.now,
blank=False, blank=False,
verbose_name='Start Time' verbose_name=_('Start Time')
) )
end = models.DateTimeField(blank=True, null=True, editable=False) end = models.DateTimeField(blank=True, null=True, editable=False)
duration = models.DurationField(null=True, editable=False) duration = models.DurationField(null=True, editable=False)
@ -270,6 +295,8 @@ class Timer(models.Model):
class Meta: class Meta:
default_permissions = ('view', 'add', 'change', 'delete') default_permissions = ('view', 'add', 'change', 'delete')
ordering = ['-active', '-start', '-end'] ordering = ['-active', '-start', '-end']
verbose_name = _('Timer')
verbose_name_plural = _('Timers')
def __str__(self): def __str__(self):
return self.name or 'Timer #{}'.format(self.id) return self.name or 'Timer #{}'.format(self.id)
@ -315,7 +342,11 @@ class Timer(models.Model):
class TummyTime(models.Model): class TummyTime(models.Model):
model_name = 'tummytime' model_name = 'tummytime'
child = models.ForeignKey( child = models.ForeignKey(
'Child', related_name='tummy_time', on_delete=models.CASCADE) 'Child',
on_delete=models.CASCADE,
related_name='tummy_time',
verbose_name=_('Child')
)
start = models.DateTimeField(blank=False, null=False) start = models.DateTimeField(blank=False, null=False)
end = models.DateTimeField(blank=False, null=False) end = models.DateTimeField(blank=False, null=False)
duration = models.DurationField(null=True, editable=False) duration = models.DurationField(null=True, editable=False)
@ -326,6 +357,8 @@ class TummyTime(models.Model):
class Meta: class Meta:
default_permissions = ('view', 'add', 'change', 'delete') default_permissions = ('view', 'add', 'change', 'delete')
ordering = ['-start'] ordering = ['-start']
verbose_name = _('Tummy Time')
verbose_name_plural = _('Tummy Time')
def __str__(self): def __str__(self):
return 'Tummy Time' return 'Tummy Time'
@ -346,7 +379,11 @@ class TummyTime(models.Model):
class Weight(models.Model): class Weight(models.Model):
model_name = 'weight' model_name = 'weight'
child = models.ForeignKey( child = models.ForeignKey(
'Child', related_name='weight', on_delete=models.CASCADE) 'Child',
on_delete=models.CASCADE,
related_name='weight',
verbose_name=_('Child')
)
weight = models.FloatField(blank=False, null=False) weight = models.FloatField(blank=False, null=False)
date = models.DateField(blank=False, null=False) date = models.DateField(blank=False, null=False)
@ -355,7 +392,8 @@ class Weight(models.Model):
class Meta: class Meta:
default_permissions = ('view', 'add', 'change', 'delete') default_permissions = ('view', 'add', 'change', 'delete')
ordering = ['-date'] ordering = ['-date']
verbose_name_plural = 'Weight' verbose_name = _('Weight')
verbose_name_plural = _('Weight')
def __str__(self): def __str__(self):
return 'Weight' return 'Weight'

View File

@ -1,20 +1,22 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load widget_tweaks %} {% load i18n widget_tweaks %}
{% block title %}Delete a Child{% endblock %} {% block title %}{% trans "Delete a Child" %}{% endblock %}
{% block breadcrumbs %} {% 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 font-weight-bold"><a href="{% url 'core:child' object.slug %}">{{ object }}</a></li>
<li class="breadcrumb-item active" aria-current="page">Delete</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Delete" %}</li>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<form role="form" method="post"> <form role="form" method="post">
{% csrf_token %} {% csrf_token %}
<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1> {% blocktrans %}<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1>{% endblocktrans %}
<div class="form-group"> <div class="form-group">
<label for="{{ form.confirm_name.id_for_label }}">To confirm this action. Type the full name of the child below.</label> <label for="{{ form.confirm_name.id_for_label }}">
{% trans "To confirm this action. Type the full name of the child below." %}
</label>
{% if form.confirm_name.errors %} {% if form.confirm_name.errors %}
{{ form.confirm_name|add_class:"form-control is-invalid" }} {{ form.confirm_name|add_class:"form-control is-invalid" }}
{% else %} {% else %}
@ -24,7 +26,7 @@
<div class="invalid-feedback">{{ form.confirm_name.errors.0 }}</div> <div class="invalid-feedback">{{ form.confirm_name.errors.0 }}</div>
{% endif %} {% endif %}
</div> </div>
<input type="submit" value="Delete" class="btn btn-danger" /> <input type="submit" value="{% trans "Delete" %}" class="btn btn-danger" />
<a href="{% url 'core:child-list' %}" class="btn btn-default">Cancel</a> <a href="{% url 'core:child-list' %}" class="btn btn-default">{% trans "Cancel" %}</a>
</form> </form>
{% endblock %} {% endblock %}

View File

@ -1,10 +1,10 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load static thumbnail %} {% load i18n static thumbnail %}
{% block title %}{{ object }}{% endblock %} {% block title %}{{ object }}{% endblock %}
{% block breadcrumbs %} {% 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">{{ object }}</li> <li class="breadcrumb-item font-weight-bold">{{ object }}</li>
{% endblock %} {% endblock %}
@ -20,8 +20,8 @@
{% endif %} {% endif %}
<div class="child-name display-4">{{ object }}</div> <div class="child-name display-4">{{ object }}</div>
<p class="lead"> <p class="lead">
Born <span class="text-secondary">{{ object.birth_date }}</span><br/> {% trans "Born" %} <span class="text-secondary">{{ object.birth_date }}</span><br/>
Age <span class="text-secondary">{{ object.birth_date|timesince }}</span> {% trans "Age" %} <span class="text-secondary">{{ object.birth_date|timesince }}</span>
</p> </p>
{% include 'dashboard/child_button_group.html' %} {% include 'dashboard/child_button_group.html' %}
</div> </div>
@ -31,16 +31,16 @@
<div class="col-lg-8 offset-lg-4 col-md-6 offset-md-6"> <div class="col-lg-8 offset-lg-4 col-md-6 offset-md-6">
<h3 class="text-center"> <h3 class="text-center">
{% if date_previous %} {% if date_previous %}
<a class="btn btn-sm btn-default" href="?date={{ date_previous|date:"Y-m-d" }}" aria-label="Previous"> <a class="btn btn-sm btn-default" href="?date={{ date_previous|date:"Y-m-d" }}" aria-label="{% trans "Previous" %}">
<i class="icon icon-chevron-left" aria-hidden="true"></i> <i class="icon icon-chevron-left" aria-hidden="true"></i>
<span class="sr-only">Previous</span> <span class="sr-only">{% trans "Previous" %}</span>
</a> </a>
{% endif %} {% endif %}
{{ date|date }} {{ date|date }}
{% if date_next %} {% if date_next %}
<a class="btn btn-sm btn-default" href="?date={{ date_next|date:"Y-m-d" }}" aria-label="Next"> <a class="btn btn-sm btn-default" href="?date={{ date_next|date:"Y-m-d" }}" aria-label="{% trans "Next" %}">
<i class="icon icon-chevron-right" aria-hidden="true"></i> <i class="icon icon-chevron-right" aria-hidden="true"></i>
<span class="sr-only">Next</span> <span class="sr-only">{% trans "Next" %}</span>
</a> </a>
{% endif %} {% endif %}
</h3> </h3>

View File

@ -1,28 +1,29 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load i18n %}
{% block title %} {% block title %}
{% if object %} {% if object %}
{{ object }} {{ object }}
{% else %} {% else %}
Add a Child {% trans "Add a Child" %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block breadcrumbs %} {% 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>
{% if object %} {% if object %}
<li class="breadcrumb-item font-weight-bold"><a href="{% url 'core:child' object.slug %}">{{ object }}</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">Update</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Update" %}</li>
{% else %} {% else %}
<li class="breadcrumb-item active" aria-current="page">Add a Child</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Add a Child" %}</li>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% if object %} {% if object %}
<h1>Update <span class="text-info">{{ object }}</span></h1> {% blocktrans %}<h1>Update <span class="text-info">{{ object }}</span></h1>{% endblocktrans %}
{% else %} {% else %}
<h1>Add a Child</h1> <h1>{% trans "Add a Child" %}</h1>
{% endif %} {% endif %}
{% include 'babybuddy/form.html' %} {% include 'babybuddy/form.html' %}
{% endblock %} {% endblock %}

View File

@ -1,10 +1,10 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load widget_tweaks static thumbnail %} {% load i18n static thumbnail widget_tweaks %}
{% block title %}Children{% endblock %} {% block title %}{% trans "Children" %}{% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item active" aria-current="page">Children</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Children" %}</li>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
@ -15,10 +15,10 @@
<thead class="thead-inverse"> <thead class="thead-inverse">
<tr> <tr>
<th class="picture-column"><i class="icon icon-camera" aria-hidden="true"></i></th> <th class="picture-column"><i class="icon icon-camera" aria-hidden="true"></i></th>
<th>First Name</th> <th>{% trans "First Name" %}</th>
<th>Last Name</th> <th>{% trans "Last Name" %}</th>
<th>Birth Date</th> <th>{% trans "Birth Date" %}</th>
<th class="text-center">Actions</th> <th class="text-center">{% trans "Actions" %}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -38,7 +38,7 @@
<td>{{ child.last_name }}</td> <td>{{ child.last_name }}</td>
<td>{{ child.birth_date }}</td> <td>{{ child.birth_date }}</td>
<td class="text-center"> <td class="text-center">
<div class="btn-group btn-group-sm" role="group" aria-label="Actions"> <div class="btn-group btn-group-sm" role="group" aria-label="{% trans "Actions" %}">
{% if perms.core.change_child %} {% if perms.core.change_child %}
<a href="{% url 'core:child-update' child.slug %}" class="btn btn-warning"> <a href="{% url 'core:child-update' child.slug %}" class="btn btn-warning">
@ -57,7 +57,7 @@
</tr> </tr>
{% empty %} {% empty %}
<tr> <tr>
<th colspan="4">No children found.</th> <th colspan="4">{% trans "No children found." %}</th>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
@ -67,7 +67,7 @@
{% if perms.core.add_child %} {% if perms.core.add_child %}
<a href="{% url 'core:child-add' %}" class="btn btn-sm btn-success"> <a href="{% url 'core:child-add' %}" class="btn btn-sm btn-success">
<i class="icon icon-child" aria-hidden="true"></i> Add a Child <i class="icon icon-child" aria-hidden="true"></i> {% trans "Add a Child" %}
</a> </a>
{% endif %} {% endif %}

View File

@ -1,18 +1,18 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load widget_tweaks %} {% load i18n widget_tweaks %}
{% block title %}Delete a Diaper Change{% endblock %} {% block title %}{% trans "Delete a Diaper Change" %}{% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item"><a href="{% url 'core:diaperchange-list' %}">Diaper Changes</a></li> <li class="breadcrumb-item"><a href="{% url 'core:diaperchange-list' %}">{% trans "Diaper Changes" %}</a></li>
<li class="breadcrumb-item active" aria-current="page">Delete</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Delete" %}</li>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<form role="form" method="post"> <form role="form" method="post">
{% csrf_token %} {% csrf_token %}
<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1> {% blocktrans %}<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1>{% endblocktrans %}
<input type="submit" value="Delete" class="btn btn-danger" /> <input type="submit" value="{% trans "Delete" %}" class="btn btn-danger" />
<a href="{% url 'core:diaperchange-list' %}" class="btn btn-default">Cancel</a> <a href="{% url 'core:diaperchange-list' %}" class="btn btn-default">{% trans "Cancel" %}</a>
</form> </form>
{% endblock %} {% endblock %}

View File

@ -1,27 +1,28 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load i18n %}
{% block title %} {% block title %}
{% if request.resolver_match.url_name == 'diaperchange-update' %} {% if request.resolver_match.url_name == 'diaperchange-update' %}
Update a Diaper Change {% trans "Update a Diaper Change" %}
{% else %} {% else %}
Add a Diaper Change {% trans "Add a Diaper Change" %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item"><a href="{% url 'core:diaperchange-list' %}">Diaper Changes</a></li> <li class="breadcrumb-item"><a href="{% url 'core:diaperchange-list' %}">{% trans "Diaper Changes" %}</a></li>
{% if object %} {% if object %}
<li class="breadcrumb-item active" aria-current="page">Update</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Update" %}</li>
{% else %} {% else %}
<li class="breadcrumb-item active" aria-current="page">Add</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Add" %}</li>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% if object %} {% if object %}
<h1>Update <span class="text-info">{{ object }}</span></h1> {% blocktrans %}<h1>Update <span class="text-info">{{ object }}</span></h1>{% endblocktrans %}
{% else %} {% else %}
<h1>Add a Diaper Change</h1> <h1>{% trans "Add a Diaper Change" %}</h1>
{% endif %} {% endif %}
{% include 'babybuddy/form.html' %} {% include 'babybuddy/form.html' %}
{% endblock %} {% endblock %}

View File

@ -1,26 +1,25 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load widget_tweaks %} {% load bootstrap i18n widget_tweaks %}
{% load bootstrap %}
{% block title %}Diaper Changes{% endblock %} {% block title %}{% trans "Diaper Changes" %}{% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item active" aria-current="page">Diaper Changes</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Diaper Changes" %}</li>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h1>Diaper Changes</h1> <h1>{% trans "Diaper Changes" %}</h1>
{% include 'babybuddy/filter.html' %} {% include 'babybuddy/filter.html' %}
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<thead class="thead-inverse"> <thead class="thead-inverse">
<tr> <tr>
<th>Child</th> <th>{% trans "Child" %}</th>
<th class="text-center">Wet</th> <th class="text-center">{% trans "Wet" %}</th>
<th class="text-center">Solid</th> <th class="text-center">{% trans "Solid" %}</th>
<th>Color</th> <th>{% trans "Color" %}</th>
<th>Time</th> <th>{% trans "Time" %}</th>
<th class="text-center">Actions</th> <th class="text-center">{% trans "Actions" %}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -32,7 +31,7 @@
<td>{{ change.color }}</td> <td>{{ change.color }}</td>
<td>{{ change.time|date:'n/j/y G:i' }}</td> <td>{{ change.time|date:'n/j/y G:i' }}</td>
<td class="text-center"> <td class="text-center">
<div class="btn-group btn-group-sm" role="group" aria-label="Actions"> <div class="btn-group btn-group-sm" role="group" aria-label="{% trans "Actions" %}">
{% if perms.core.change_diaperchange %} {% if perms.core.change_diaperchange %}
<a href="{% url 'core:diaperchange-update' change.id %}" class="btn btn-primary"> <a href="{% url 'core:diaperchange-update' change.id %}" class="btn btn-primary">
@ -51,7 +50,7 @@
</tr> </tr>
{% empty %} {% empty %}
<tr> <tr>
<th colspan="6">No diaper changes found.</th> <th colspan="6">{% trans "No diaper changes found." %}</th>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
@ -61,7 +60,7 @@
{% if perms.core.add_diaperchange %} {% if perms.core.add_diaperchange %}
<a href="{% url 'core:diaperchange-add' %}" class="btn btn-sm btn-success"> <a href="{% url 'core:diaperchange-add' %}" class="btn btn-sm btn-success">
<i class="icon icon-diaperchange" aria-hidden="true"></i> Add a Change <i class="icon icon-diaperchange" aria-hidden="true"></i> {% trans "Add a Change" %}
</a> </a>
{% endif %} {% endif %}

View File

@ -1,18 +1,18 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load widget_tweaks %} {% load i18n widget_tweaks %}
{% block title %}Delete a Feeding{% endblock %} {% block title %}{% trans "Delete a Feeding" %}{% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item"><a href="{% url 'core:feeding-list' %}">Feedings</a></li> <li class="breadcrumb-item"><a href="{% url 'core:feeding-list' %}">{% trans "Feedings" %}</a></li>
<li class="breadcrumb-item active" aria-current="page">Delete</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Delete" %}</li>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<form role="form" method="post"> <form role="form" method="post">
{% csrf_token %} {% csrf_token %}
<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1> {% blocktrans %}<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1>{% endblocktrans %}
<input type="submit" value="Delete" class="btn btn-danger" /> <input type="submit" value="{% trans "Delete" %}" class="btn btn-danger" />
<a href="{% url 'core:feeding-list' %}" class="btn btn-default">Cancel</a> <a href="{% url 'core:feeding-list' %}" class="btn btn-default">{% trans "Cancel" %}</a>
</form> </form>
{% endblock %} {% endblock %}

View File

@ -1,27 +1,28 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load i18n %}
{% block title %} {% block title %}
{% if request.resolver_match.url_name == 'feeding-update' %} {% if request.resolver_match.url_name == 'feeding-update' %}
Update a Feeding {% trans "Update a Feeding" %}
{% else %} {% else %}
Add a Feeding {% trans "Add a Feeding" %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item"><a href="{% url 'core:feeding-list' %}">Feedings</a></li> <li class="breadcrumb-item"><a href="{% url 'core:feeding-list' %}">{% trans "Feedings" %}</a></li>
{% if object %} {% if object %}
<li class="breadcrumb-item active" aria-current="page">Update</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Update" %}</li>
{% else %} {% else %}
<li class="breadcrumb-item active" aria-current="page">Add</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Add" %}</li>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% if object %} {% if object %}
<h1>Update <span class="text-info">{{ object }}</span></h1> {% blocktrans %}<h1>Update <span class="text-info">{{ object }}</span></h1>{% endblocktrans %}
{% else %} {% else %}
<h1>Add a Feeding</h1> <h1>{% trans "Add a Feeding" %}</h1>
{% endif %} {% endif %}
{% include 'babybuddy/form.html' %} {% include 'babybuddy/form.html' %}
{% endblock %} {% endblock %}

View File

@ -1,11 +1,10 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load widget_tweaks %} {% load duration i18n widget_tweaks %}
{% load duration %}
{% block title %}Feedings{% endblock %} {% block title %}{% trans "Feedings" %}{% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item active" aria-current="page">Feedings</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Feedings" %}</li>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
@ -15,13 +14,14 @@
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<thead class="thead-inverse"> <thead class="thead-inverse">
<tr> <tr>
<th>Child</th> <th>{% trans "Child" %}</th>
<th>Method</th> <th>{% trans "Method" %}</th>
<th>Type</th> <th>{% trans "Type" %}</th>
<th>Amt.</th> {% comment %}Abbreviation of "Amount"{% endcomment %}
<th>Duration</th> <th>{% trans "Amt." %}</th>
<th>Date</th> <th>{% trans "Duration" %}</th>
<th class="text-center">Actions</th> <th>{% trans "Date" %}</th>
<th class="text-center">{% trans "Actions" %}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -38,7 +38,7 @@
<td>{{ feeding.duration|duration_string }}</td> <td>{{ feeding.duration|duration_string }}</td>
<td>{{ feeding.start|date:'n/j/y G:i' }}</td> <td>{{ feeding.start|date:'n/j/y G:i' }}</td>
<td class="text-center"> <td class="text-center">
<div class="btn-group btn-group-sm" role="group" aria-label="Actions"> <div class="btn-group btn-group-sm" role="group" aria-label="{% trans "Actions" %}">
{% if perms.core.change_feeding %} {% if perms.core.change_feeding %}
<a href="{% url 'core:feeding-update' feeding.id %}" class="btn btn-primary"> <a href="{% url 'core:feeding-update' feeding.id %}" class="btn btn-primary">
@ -57,7 +57,7 @@
</tr> </tr>
{% empty %} {% empty %}
<tr> <tr>
<th colspan="7">No feedings found.</th> <th colspan="7">{% trans "No feedings found." %}</th>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
@ -67,7 +67,7 @@
{% if perms.core.add_feeding %} {% if perms.core.add_feeding %}
<a href="{% url 'core:feeding-add' %}" class="btn btn-sm btn-success"> <a href="{% url 'core:feeding-add' %}" class="btn btn-sm btn-success">
<i class="icon icon-feeding" aria-hidden="true"></i> Add a Feeding <i class="icon icon-feeding" aria-hidden="true"></i> {% trans "Add a Feeding" %}
</a> </a>
{% endif %} {% endif %}

View File

@ -1,18 +1,18 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load widget_tweaks %} {% load i18n widget_tweaks %}
{% block title %}Delete a Note{% endblock %} {% block title %}{% trans "Delete a Note" %}{% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item"><a href="{% url 'core:note-list' %}">Notes</a></li> <li class="breadcrumb-item"><a href="{% url 'core:note-list' %}">{% trans "Notes" %}</a></li>
<li class="breadcrumb-item active" aria-current="page">Delete</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Delete" %}</li>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<form role="form" method="post"> <form role="form" method="post">
{% csrf_token %} {% csrf_token %}
<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1> {% blocktrans %}<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1>{% endblocktrans %}
<input type="submit" value="Delete" class="btn btn-danger" /> <input type="submit" value="{% trans "Delete" %}" class="btn btn-danger" />
<a href="{% url 'core:note-list' %}" class="btn btn-default">Cancel</a> <a href="{% url 'core:note-list' %}" class="btn btn-default">{% trans "Cancel" %}</a>
</form> </form>
{% endblock %} {% endblock %}

View File

@ -1,27 +1,28 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load i18n %}
{% block title %} {% block title %}
{% if request.resolver_match.url_name == 'note-update' %} {% if request.resolver_match.url_name == 'note-update' %}
Update a Note {% trans "Update a Note" %}
{% else %} {% else %}
Add a Note {% trans "Add a Note" %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item"><a href="{% url 'core:note-list' %}">Notes</a></li> <li class="breadcrumb-item"><a href="{% url 'core:note-list' %}">{% trans "Notes" %}</a></li>
{% if object %} {% if object %}
<li class="breadcrumb-item active" aria-current="page">Update</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Update" %}</li>
{% else %} {% else %}
<li class="breadcrumb-item active" aria-current="page">Add</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Add" %}</li>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% if object %} {% if object %}
<h1>Update <span class="text-info">{{ object }}</span></h1> {% blocktrans %}<h1>Update <span class="text-info">{{ object }}</span></h1>{% endblocktrans %}
{% else %} {% else %}
<h1>Add a Note</h1> <h1>{% trans "Add a Note" %}</h1>
{% endif %} {% endif %}
{% include 'babybuddy/form.html' %} {% include 'babybuddy/form.html' %}
{% endblock %} {% endblock %}

View File

@ -1,10 +1,10 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load widget_tweaks %} {% load i18n widget_tweaks %}
{% block title %}Notes{% endblock %} {% block title %}{% trans "Notes" %}{% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item active" aria-current="page">Notes</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Notes" %}</li>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
@ -14,10 +14,10 @@
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<thead class="thead-inverse"> <thead class="thead-inverse">
<tr> <tr>
<th>Child</th> <th>{% trans "Child" %}</th>
<th>Note</th> <th>{% trans "Note" %}</th>
<th>Time</th> <th>{% trans "Time" %}</th>
<th class="text-center">Actions</th> <th class="text-center">{% trans "Actions" %}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -27,7 +27,7 @@
<td>{{ note.note }}</td> <td>{{ note.note }}</td>
<td>{{ note.time }}</td> <td>{{ note.time }}</td>
<td class="text-center"> <td class="text-center">
<div class="btn-group btn-group-sm" role="group" aria-label="Actions"> <div class="btn-group btn-group-sm" role="group" aria-label="{% trans "Actions" %}">
{% if perms.core.change_note %} {% if perms.core.change_note %}
<a href="{% url 'core:note-update' note.id %}" class="btn btn-primary"> <a href="{% url 'core:note-update' note.id %}" class="btn btn-primary">
@ -46,7 +46,7 @@
</tr> </tr>
{% empty %} {% empty %}
<tr> <tr>
<th colspan="4">No notes found.</th> <th colspan="4">{% trans "No notes found." %}</th>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
@ -56,7 +56,7 @@
{% if perms.core.add_note %} {% if perms.core.add_note %}
<a href="{% url 'core:note-add' %}" class="btn btn-sm btn-success"> <a href="{% url 'core:note-add' %}" class="btn btn-sm btn-success">
<i class="icon icon-note" aria-hidden="true"></i> Add a Note <i class="icon icon-note" aria-hidden="true"></i> {% trans "Add a Note" %}
</a> </a>
{% endif %} {% endif %}

View File

@ -1,18 +1,18 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load widget_tweaks %} {% load i18n widget_tweaks %}
{% block title %}Delete a Sleep Entry{% endblock %} {% block title %}{% trans "Delete a Sleep Entry" %}{% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item"><a href="{% url 'core:sleep-list' %}">Sleep</a></li> <li class="breadcrumb-item"><a href="{% url 'core:sleep-list' %}">{% trans "Sleep" %}</a></li>
<li class="breadcrumb-item active" aria-current="page">Delete</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Delete" %}</li>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<form role="form" method="post"> <form role="form" method="post">
{% csrf_token %} {% csrf_token %}
<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1> {% blocktrans %}<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1>{% endblocktrans %}
<input type="submit" value="Delete" class="btn btn-danger" /> <input type="submit" value="{% trans "Delete" %}" class="btn btn-danger" />
<a href="{% url 'core:sleep-list' %}" class="btn btn-default">Cancel</a> <a href="{% url 'core:sleep-list' %}" class="btn btn-default">{% trans "Cancel" %}</a>
</form> </form>
{% endblock %} {% endblock %}

View File

@ -1,27 +1,28 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load i18n %}
{% block title %} {% block title %}
{% if request.resolver_match.url_name == 'sleep-update' %} {% if request.resolver_match.url_name == 'sleep-update' %}
Update a Sleep Entry {% trans "Update a Sleep Entry" %}
{% else %} {% else %}
Add a Sleep Entry {% trans "Add a Sleep Entry" %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item"><a href="{% url 'core:sleep-list' %}">Sleep</a></li> <li class="breadcrumb-item"><a href="{% url 'core:sleep-list' %}">{% trans "Sleep" %}</a></li>
{% if object %} {% if object %}
<li class="breadcrumb-item active" aria-current="page">Update</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Update" %}</li>
{% else %} {% else %}
<li class="breadcrumb-item active" aria-current="page">Add</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Add" %}</li>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% if object %} {% if object %}
<h1>Update <span class="text-info">{{ object }}</span></h1> {% blocktrans %}<h1>Update <span class="text-info">{{ object }}</span></h1>{% endblocktrans %}
{% else %} {% else %}
<h1>Add a Sleep Entry</h1> <h1>{% trans "Add a Sleep Entry" %}</h1>
{% endif %} {% endif %}
{% include 'babybuddy/form.html' %} {% include 'babybuddy/form.html' %}
{% endblock %} {% endblock %}

View File

@ -1,10 +1,10 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load bootstrap duration widget_tweaks %} {% load bootstrap duration i18n widget_tweaks %}
{% block title %}Sleep{% endblock %} {% block title %}{% trans "Sleep" %}{% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item active" aria-current="page">Sleep</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Sleep" %}</li>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
@ -14,12 +14,12 @@
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<thead class="thead-inverse"> <thead class="thead-inverse">
<tr> <tr>
<th>Child</th> <th>{% trans "Child" %}</th>
<th>Duration</th> <th>{% trans "Duration" %}</th>
<th>Start</th> <th>{% trans "Start" %}</th>
<th>End</th> <th>{% trans "End" %}</th>
<th class="text-center">Nap</th> <th class="text-center">{% trans "Nap" %}</th>
<th class="text-center">Actions</th> <th class="text-center">{% trans "Actions" %}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -31,7 +31,7 @@
<td>{{ sleep.end|date:'n/j/y G:i' }}</td> <td>{{ sleep.end|date:'n/j/y G:i' }}</td>
<td class="text-center">{{ sleep.nap|bool_icon }}</td> <td class="text-center">{{ sleep.nap|bool_icon }}</td>
<td class="text-center"> <td class="text-center">
<div class="btn-group btn-group-sm" role="group" aria-label="Actions"> <div class="btn-group btn-group-sm" role="group" aria-label="{% trans "Actions" %}">
{% if perms.core.change_sleep %} {% if perms.core.change_sleep %}
<a href="{% url 'core:sleep-update' sleep.id %}" class="btn btn-primary"> <a href="{% url 'core:sleep-update' sleep.id %}" class="btn btn-primary">
@ -50,7 +50,7 @@
</tr> </tr>
{% empty %} {% empty %}
<tr> <tr>
<th colspan="5">No sleep entries found.</th> <th colspan="5">{% trans "No sleep entries found." %}</th>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
@ -60,7 +60,7 @@
{% if perms.core.add_sleep %} {% if perms.core.add_sleep %}
<a href="{% url 'core:sleep-add' %}" class="btn btn-sm btn-success"> <a href="{% url 'core:sleep-add' %}" class="btn btn-sm btn-success">
<i class="icon icon-sleep" aria-hidden="true"></i> Add a Sleep Entry <i class="icon icon-sleep" aria-hidden="true"></i> {% trans "Add a Sleep Entry" %}
</a> </a>
{% endif %} {% endif %}

View File

@ -1,19 +1,19 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load widget_tweaks %} {% load i18n widget_tweaks %}
{% block title %}Delete {{ object }}{% endblock %} {% block title %}{% blocktrans %}Delete {{ object }}{% endblocktrans %}{% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item"><a href="{% url 'core:timer-list' %}">Timers</a></li> <li class="breadcrumb-item"><a href="{% url 'core:timer-list' %}">{% trans "Timers" %}</a></li>
<li class="breadcrumb-item font-weight-bold"><a href="{% url 'core:timer-detail' object.id %}">{{ object }}</a></li> <li class="breadcrumb-item font-weight-bold"><a href="{% url 'core:timer-detail' object.id %}">{{ object }}</a></li>
<li class="breadcrumb-item active" aria-current="page">Delete</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Delete" %}</li>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<form role="form" method="post"> <form role="form" method="post">
{% csrf_token %} {% csrf_token %}
<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1> {% blocktrans %}<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1>{% endblocktrans %}
<input type="submit" value="Delete" class="btn btn-danger" /> <input type="submit" value="{% trans "Delete" %}" class="btn btn-danger" />
<a href="/" class="btn btn-default">Cancel</a> <a href="/" class="btn btn-default">{% trans "Cancel" %}</a>
</form> </form>
{% endblock %} {% endblock %}

View File

@ -1,10 +1,10 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load duration timers %} {% load duration i18n timers %}
{% block title %}{{ object }}{% endblock %} {% block title %}{{ object }}{% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item"><a href="{% url 'core:timer-list' %}">Timers</a></li> <li class="breadcrumb-item"><a href="{% url 'core:timer-list' %}">{% trans "Timers" %}</a></li>
<li class="breadcrumb-item font-weight-bold">{{ object }}</li> <li class="breadcrumb-item font-weight-bold">{{ object }}</li>
{% endblock %} {% endblock %}
@ -17,34 +17,40 @@
<span class="timer-seconds">{{ object.duration|seconds }}</span>s <span class="timer-seconds">{{ object.duration|seconds }}</span>s
</div> </div>
<p class="lead text-secondary"> <p class="lead text-secondary">
Started {{ object.start }} {% trans "Started" %} {{ object.start }}
{% if not object.active %} {% if not object.active %}
/ Stopped {{ object.end }} / {% trans "Stopped" %} {{ object.end }}
{% endif %} {% endif %}
</p> </p>
<p class="text-muted"> <p class="text-muted">
{{ timer }} created by {{ object.user }} {% blocktrans %}{{ timer }} created by {{ object.user }}{% endblocktrans %}
</p> </p>
{% if perms.core.add_feeding %} {% if perms.core.add_feeding %}
<a class="btn btn-success btn-lg btn-block mb-3" <a class="btn btn-success btn-lg btn-block mb-3"
href="{% url 'core:feeding-add' %}?timer={{ timer.id }}" href="{% url 'core:feeding-add' %}?timer={{ timer.id }}"
role="button"><i class="icon icon-feeding" aria-hidden="true"></i> Feeding</a> role="button"><i class="icon icon-feeding" aria-hidden="true"></i>
{% trans "Feeding" %}
</a>
{% endif %} {% endif %}
{% if perms.core.add_sleep %} {% if perms.core.add_sleep %}
<a class="btn btn-success btn-lg btn-block mb-3" <a class="btn btn-success btn-lg btn-block mb-3"
href="{% url 'core:sleep-add' %}?timer={{ timer.id }}" href="{% url 'core:sleep-add' %}?timer={{ timer.id }}"
role="button"><i class="icon icon-sleep" aria-hidden="true"></i> Sleep</a> role="button"><i class="icon icon-sleep" aria-hidden="true"></i>
{% trans "Sleep" %}
</a>
{% endif %} {% endif %}
{% if perms.core.add_tummytime %} {% if perms.core.add_tummytime %}
<a class="btn btn-success btn-lg btn-block mb-3" <a class="btn btn-success btn-lg btn-block mb-3"
href="{% url 'core:tummytime-add' %}?timer={{ timer.id }}" href="{% url 'core:tummytime-add' %}?timer={{ timer.id }}"
role="button"><i class="icon icon-tummytime" aria-hidden="true"></i> Tummy Time</a> role="button"><i class="icon icon-tummytime" aria-hidden="true"></i>
{% trans "Tummy Time" %}
</a>
{% endif %} {% endif %}
<div class="btn-group btn-group-lg center-block" role="group" aria-label="Timer actions"> <div class="btn-group btn-group-lg center-block" role="group" aria-label="{% trans "Timer actions" %}">
{% if perms.core.delete_timer %} {% if perms.core.delete_timer %}
<a class="btn btn-danger" <a class="btn btn-danger"

View File

@ -1,23 +1,23 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load duration %} {% load duration i18n %}
{% block title %}Timer{% endblock %} {% block title %}{% trans "Timer" %}{% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item"><a href="{% url 'core:timer-list' %}">Timers</a></li> <li class="breadcrumb-item"><a href="{% url 'core:timer-list' %}">{% trans "Timers" %}</a></li>
{% if object %} {% if object %}
<li class="breadcrumb-item font-weight-bold"><a href="{% url 'core:timer-detail' object.id %}">{{ object }}</a></li> <li class="breadcrumb-item font-weight-bold"><a href="{% url 'core:timer-detail' object.id %}">{{ object }}</a></li>
<li class="breadcrumb-item active" aria-current="page">Update</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Update" %}</li>
{% else %} {% else %}
<li class="breadcrumb-item active" aria-current="page">Start</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Start" %}</li>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% if object %} {% if object %}
<h1>Update <span class="text-info">{{ object }}</span></h1> {% blocktrans %}<h1>Update <span class="text-info">{{ object }}</span></h1>{% endblocktrans %}
{% else %} {% else %}
<h1>Start Timer</h1> <h1>{% trans "Start Timer" %}</h1>
{% endif %} {% endif %}
{% include 'babybuddy/form.html' %} {% include 'babybuddy/form.html' %}
{% endblock %} {% endblock %}

View File

@ -1,10 +1,10 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load bootstrap duration widget_tweaks %} {% load bootstrap duration i18n widget_tweaks %}
{% block title %}Timers{% endblock %} {% block title %}{% trans "Timers" %}{% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item active" aria-current="page">Timers</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Timers" %}</li>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
@ -14,12 +14,12 @@
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<thead class="thead-inverse"> <thead class="thead-inverse">
<tr> <tr>
<th>Name</th> <th>{% trans "Name" %}</th>
<th>Start</th> <th>{% trans "Start" %}</th>
<th>Duration</th> <th>{% trans "Duration" %}</th>
<th>End</th> <th>{% trans "End" %}</th>
<th>Active</th> <th>{% trans "Active" %}</th>
<th>User</th> <th>{% trans "User" %}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -34,7 +34,7 @@
</tr> </tr>
{% empty %} {% empty %}
<tr> <tr>
<th colspan="7">No timer entries found.</th> <th colspan="7">{% trans "No timer entries found." %}</th>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>

View File

@ -1,30 +1,34 @@
{% load i18n %}
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a id="nav-timer-menu-link" <a id="nav-timer-menu-link"
class="nav-link dropdown-toggle" class="nav-link dropdown-toggle"
href="#" href="#"
data-toggle="dropdown" data-toggle="dropdown"
aria-haspopup="true" aria-haspopup="true"
aria-expanded="false"><i class="icon icon-timer" aria-hidden="true"></i> Timers</a> aria-expanded="false"><i class="icon icon-timer" aria-hidden="true"></i>
{% trans "Timers" %}
</a>
<div class="dropdown-menu" aria-labelledby="nav-timer-menu-link"> <div class="dropdown-menu" aria-labelledby="nav-timer-menu-link">
{% if perms.core.add_timer %} {% if perms.core.add_timer %}
<a class="dropdown-item" href="{% url 'core:timer-add-quick' %}"> <a class="dropdown-item" href="{% url 'core:timer-add-quick' %}">
<i class="icon icon-timer" aria-hidden="true"></i> Quick Start Timer <i class="icon icon-timer" aria-hidden="true"></i> {% trans "Quick Start Timer" %}
</a> </a>
<a class="dropdown-item" href="{% url 'core:timer-add' %}"> <a class="dropdown-item" href="{% url 'core:timer-add' %}">
<i class="icon icon-add" aria-hidden="true"></i> Start Timer <i class="icon icon-add" aria-hidden="true"></i> {% trans "Start Timer" %}
</a> </a>
{% endif %} {% endif %}
{% if perms.core.view_timer %} {% if perms.core.view_timer %}
<a class="dropdown-item" href="{% url 'core:timer-list' %}"> <a class="dropdown-item" href="{% url 'core:timer-list' %}">
<i class="icon icon-list" aria-hidden="true"></i> View Timers <i class="icon icon-list" aria-hidden="true"></i> {% trans "View Timers" %}
</a> </a>
{% endif %} {% endif %}
{% if timers %} {% if timers %}
<h6 class="dropdown-header">Active Timers</h6> <h6 class="dropdown-header">{% trans "Active Timers" %}</h6>
{% for timer in timers %} {% for timer in timers %}
<a class="dropdown-item" href="{% url 'core:timer-detail' timer.id %}">{{ timer }} ({{ timer.user }})</a> <a class="dropdown-item" href="{% url 'core:timer-detail' timer.id %}">{{ timer }} ({{ timer.user }})</a>
{% empty %} {% empty %}
<a class="dropdown-item disabled" href="#">None</a> <a class="dropdown-item disabled" href="#">{% trans "None" %}</a>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
</div> </div>

View File

@ -1,18 +1,18 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load widget_tweaks %} {% load i18n widget_tweaks %}
{% block title %}Delete a Tummy Time Entry{% endblock %} {% block title %}{% trans "Delete a Tummy Time Entry" %}{% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item"><a href="{% url 'core:tummytime-list' %}">Tummy Time</a></li> <li class="breadcrumb-item"><a href="{% url 'core:tummytime-list' %}">{% trans "Tummy Time" %}</a></li>
<li class="breadcrumb-item active" aria-current="page">Delete</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Delete" %}</li>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<form role="form" method="post"> <form role="form" method="post">
{% csrf_token %} {% csrf_token %}
<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1> {% blocktrans %}<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1>{% endblocktrans %}
<input type="submit" value="Delete" class="btn btn-danger" /> <input type="submit" value="{% trans "Delete" %}" class="btn btn-danger" />
<a href="{% url 'core:tummytime-list' %}" class="btn btn-default">Cancel</a> <a href="{% url 'core:tummytime-list' %}" class="btn btn-default">{% trans "Cancel" %}</a>
</form> </form>
{% endblock %} {% endblock %}

View File

@ -1,27 +1,28 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load i18n %}
{% block title %} {% block title %}
{% if request.resolver_match.url_name == 'tummytime-update' %} {% if request.resolver_match.url_name == 'tummytime-update' %}
Update a Tummy Time Entry {% trans "Update a Tummy Time Entry" %}
{% else %} {% else %}
Add a Tummy Time Entry {% trans "Add a Tummy Time Entry" %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item"><a href="{% url 'core:tummytime-list' %}">Tummy Time</a></li> <li class="breadcrumb-item"><a href="{% url 'core:tummytime-list' %}">{% trans "Tummy Time" %}</a></li>
{% if object %} {% if object %}
<li class="breadcrumb-item active" aria-current="page">Update</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Update" %}</li>
{% else %} {% else %}
<li class="breadcrumb-item active" aria-current="page">Add</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Add" %}</li>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% if object %} {% if object %}
<h1>Update <span class="text-info">{{ object }}</span></h1> {% blocktrans %}<h1>Update <span class="text-info">{{ object }}</span></h1>{% endblocktrans %}
{% else %} {% else %}
<h1>Add a Tummy Time Entry</h1> <h1>{% trans "Add a Tummy Time Entry" %}</h1>
{% endif %} {% endif %}
{% include 'babybuddy/form.html' %} {% include 'babybuddy/form.html' %}
{% endblock %} {% endblock %}

View File

@ -1,11 +1,10 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load widget_tweaks %} {% load duration i18n widget_tweaks %}
{% load duration %}
{% block title %}Tummy Time{% endblock %} {% block title %}{% trans "Tummy Time" %}{% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item active" aria-current="page">Tummy Time</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Tummy Time" %}</li>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
@ -15,12 +14,12 @@
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<thead class="thead-inverse"> <thead class="thead-inverse">
<tr> <tr>
<th>Child</th> <th>{% trans "Child" %}</th>
<th>Duration</th> <th>{% trans "Duration" %}</th>
<th>Start</th> <th>{% trans "Start" %}</th>
<th>End</th> <th>{% trans "End" %}</th>
<th>Milestone</th> <th>{% trans "Milestone" %}</th>
<th class="text-center">Actions</th> <th class="text-center">{% trans "Actions" %}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -32,7 +31,7 @@
<td>{{ tummytime.end|date:'n/j/y G:i' }}</td> <td>{{ tummytime.end|date:'n/j/y G:i' }}</td>
<td>{{ tummytime.milestone }}</td> <td>{{ tummytime.milestone }}</td>
<td class="text-center"> <td class="text-center">
<div class="btn-group btn-group-sm" role="group" aria-label="Actions"> <div class="btn-group btn-group-sm" role="group" aria-label="{% trans "Actions" %}">
{% if perms.core.change_tummytime %} {% if perms.core.change_tummytime %}
<a href="{% url 'core:tummytime-update' tummytime.id %}" class="btn btn-primary"> <a href="{% url 'core:tummytime-update' tummytime.id %}" class="btn btn-primary">
@ -51,7 +50,7 @@
</tr> </tr>
{% empty %} {% empty %}
<tr> <tr>
<th colspan="6">No tummy time entries found.</th> <th colspan="6">{% trans "No tummy time entries found." %}</th>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
@ -61,7 +60,7 @@
{% if perms.core.add_tummytime %} {% if perms.core.add_tummytime %}
<a href="{% url 'core:tummytime-add' %}" class="btn btn-sm btn-success"> <a href="{% url 'core:tummytime-add' %}" class="btn btn-sm btn-success">
<i class="icon icon-tummytime" aria-hidden="true"></i> Add a Tummy Time Entry</a> <i class="icon icon-tummytime" aria-hidden="true"></i> {% trans "Add a Tummy Time Entry" %}</a>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View File

@ -1,18 +1,18 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load widget_tweaks %} {% load i18n widget_tweaks %}
{% block title %}Delete a Weight Entry{% endblock %} {% block title %}{% trans "Delete a Weight Entry" %}{% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item"><a href="{% url 'core:weight-list' %}">Weight</a></li> <li class="breadcrumb-item"><a href="{% url 'core:weight-list' %}">{% trans "Weight" %}</a></li>
<li class="breadcrumb-item active" aria-current="page">Delete</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Delete" %}</li>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<form role="form" method="post"> <form role="form" method="post">
{% csrf_token %} {% csrf_token %}
<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1> {% blocktrans %}<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1>{% endblocktrans %}
<input type="submit" value="Delete" class="btn btn-danger" /> <input type="submit" value="{% trans "Delete" %}" class="btn btn-danger" />
<a href="{% url 'core:weight-list' %}" class="btn btn-default">Cancel</a> <a href="{% url 'core:weight-list' %}" class="btn btn-default">{% trans "Cancel" %}</a>
</form> </form>
{% endblock %} {% endblock %}

View File

@ -1,27 +1,28 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load i18n %}
{% block title %} {% block title %}
{% if object %} {% if object %}
{{ object }} {{ object }}
{% else %} {% else %}
Add a Weight Entry {% trans "Add a Weight Entry" %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item"><a href="{% url 'core:weight-list' %}">Weight</a></li> <li class="breadcrumb-item"><a href="{% url 'core:weight-list' %}">{% trans "Weight" %}</a></li>
{% if object %} {% if object %}
<li class="breadcrumb-item active" aria-current="page">Update</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Update" %}</li>
{% else %} {% else %}
<li class="breadcrumb-item active" aria-current="page">Add a Weight Entry</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Add a Weight Entry" %}</li>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% if object %} {% if object %}
<h1>Update <span class="text-info">{{ object }}</span></h1> {% blocktrans %}<h1>Update <span class="text-info">{{ object }}</span></h1>{% endblocktrans %}
{% else %} {% else %}
<h1>Add a Weight Entry</h1> <h1>{% trans "Add a Weight Entry" %}</h1>
{% endif %} {% endif %}
{% include 'babybuddy/form.html' %} {% include 'babybuddy/form.html' %}
{% endblock %} {% endblock %}

View File

@ -1,10 +1,10 @@
{% extends 'babybuddy/page.html' %} {% extends 'babybuddy/page.html' %}
{% load widget_tweaks %} {% load i18n widget_tweaks %}
{% block title %}Weight{% endblock %} {% block title %}{% trans "Weight" %}{% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item active" aria-current="page">Weight</li> <li class="breadcrumb-item active" aria-current="page">{% trans "Weight" %}</li>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
@ -14,10 +14,10 @@
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<thead class="thead-inverse"> <thead class="thead-inverse">
<tr> <tr>
<th>Child</th> <th>{% trans "Child" %}</th>
<th>Weight</th> <th>{% trans "Weight" %}</th>
<th>Date</th> <th>{% trans "Date" %}</th>
<th class="text-center">Actions</th> <th class="text-center">{% trans "Actions" %}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -27,7 +27,7 @@
<td>{{ object.weight }}</td> <td>{{ object.weight }}</td>
<td>{{ object.date }}</td> <td>{{ object.date }}</td>
<td class="text-center"> <td class="text-center">
<div class="btn-group btn-group-sm" role="group" aria-label="Actions"> <div class="btn-group btn-group-sm" role="group" aria-label="{% trans "Actions" %}">
{% if perms.core.change_weight %} {% if perms.core.change_weight %}
<a href="{% url 'core:weight-update' object.id %}" class="btn btn-primary"> <a href="{% url 'core:weight-update' object.id %}" class="btn btn-primary">
@ -46,7 +46,7 @@
</tr> </tr>
{% empty %} {% empty %}
<tr> <tr>
<th colspan="4">No weight entries found.</th> <th colspan="4">{% trans "No weight entries found." %}</th>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
@ -56,7 +56,7 @@
{% if perms.core.add_weight %} {% if perms.core.add_weight %}
<a href="{% url 'core:weight-add' %}" class="btn btn-sm btn-success"> <a href="{% url 'core:weight-add' %}" class="btn btn-sm btn-success">
<i class="icon icon-weight" aria-hidden="true"></i> Add a Weight Entry <i class="icon icon-weight" aria-hidden="true"></i> {% trans "Add a Weight Entry" %}
</a> </a>
{% endif %} {% endif %}

View File

@ -3,6 +3,7 @@ from django.contrib import messages
from django.contrib.messages.views import SuccessMessageMixin from django.contrib.messages.views import SuccessMessageMixin
from django.urls import reverse, reverse_lazy from django.urls import reverse, reverse_lazy
from django.utils import timezone from django.utils import timezone
from django.utils.translation import gettext as _
from django.views.generic.base import RedirectView from django.views.generic.base import RedirectView
from django.views.generic.detail import DetailView from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView, UpdateView, DeleteView from django.views.generic.edit import CreateView, UpdateView, DeleteView
@ -16,9 +17,9 @@ class CoreAddView(PermissionRequired403Mixin, SuccessMessageMixin, CreateView):
def get_success_message(self, cleaned_data): def get_success_message(self, cleaned_data):
cleaned_data['model'] = self.model._meta.verbose_name.title() cleaned_data['model'] = self.model._meta.verbose_name.title()
if 'child' in cleaned_data: if 'child' in cleaned_data:
self.success_message = '%(model)s entry for %(child)s added!' self.success_message = _('%(model)s entry for %(child)s added!')
else: else:
self.success_message = '%(model)s entry added!' self.success_message = _('%(model)s entry added!')
return self.success_message % cleaned_data return self.success_message % cleaned_data
@ -27,9 +28,9 @@ class CoreUpdateView(PermissionRequired403Mixin, SuccessMessageMixin,
def get_success_message(self, cleaned_data): def get_success_message(self, cleaned_data):
cleaned_data['model'] = self.model._meta.verbose_name.title() cleaned_data['model'] = self.model._meta.verbose_name.title()
if 'child' in cleaned_data: if 'child' in cleaned_data:
self.success_message = '%(model)s entry for %(child)s updated.' self.success_message = _('%(model)s entry for %(child)s updated.')
else: else:
self.success_message = '%(model)s entry updated.' self.success_message = _('%(model)s entry updated.')
return self.success_message % cleaned_data return self.success_message % cleaned_data
@ -58,7 +59,7 @@ class ChildAdd(CoreAddView):
permission_required = ('core.add_child',) permission_required = ('core.add_child',)
form_class = forms.ChildForm form_class = forms.ChildForm
success_url = reverse_lazy('core:child-list') success_url = reverse_lazy('core:child-list')
success_message = '%(first_name)s %(last_name)s added!' success_message = _('%(first_name)s %(last_name)s added!')
class ChildDetail(PermissionRequired403Mixin, DetailView): class ChildDetail(PermissionRequired403Mixin, DetailView):
@ -286,7 +287,7 @@ class TimerRestart(PermissionRequired403Mixin, RedirectView):
class TimerStop(PermissionRequired403Mixin, SuccessMessageMixin, RedirectView): class TimerStop(PermissionRequired403Mixin, SuccessMessageMixin, RedirectView):
permission_required = ('core.change_timer',) permission_required = ('core.change_timer',)
success_message = '%(timer)s stopped.' success_message = _('%(timer)s stopped.')
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
instance = models.Timer.objects.get(id=kwargs['pk']) instance = models.Timer.objects.get(id=kwargs['pk'])