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

View File

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

View File

@ -1,20 +1,22 @@
{% 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 %}
<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">Delete</li>
<li class="breadcrumb-item active" aria-current="page">{% trans "Delete" %}</li>
{% endblock %}
{% block content %}
<form role="form" method="post">
{% 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">
<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 %}
{{ form.confirm_name|add_class:"form-control is-invalid" }}
{% else %}
@ -24,7 +26,7 @@
<div class="invalid-feedback">{{ form.confirm_name.errors.0 }}</div>
{% endif %}
</div>
<input type="submit" value="Delete" class="btn btn-danger" />
<a href="{% url 'core:child-list' %}" class="btn btn-default">Cancel</a>
<input type="submit" value="{% trans "Delete" %}" class="btn btn-danger" />
<a href="{% url 'core:child-list' %}" class="btn btn-default">{% trans "Cancel" %}</a>
</form>
{% endblock %}

View File

@ -1,10 +1,10 @@
{% extends 'babybuddy/page.html' %}
{% load static thumbnail %}
{% load i18n static thumbnail %}
{% block title %}{{ 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">{{ object }}</li>
{% endblock %}
@ -20,8 +20,8 @@
{% endif %}
<div class="child-name display-4">{{ object }}</div>
<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>
@ -31,16 +31,16 @@
<div class="col-lg-8 offset-lg-4 col-md-6 offset-md-6">
<h3 class="text-center">
{% 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>
<span class="sr-only">Previous</span>
<span class="sr-only">{% trans "Previous" %}</span>
</a>
{% endif %}
{{ date|date }}
{% 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>
<span class="sr-only">Next</span>
<span class="sr-only">{% trans "Next" %}</span>
</a>
{% endif %}
</h3>

View File

@ -1,28 +1,29 @@
{% extends 'babybuddy/page.html' %}
{% load i18n %}
{% block title %}
{% if object %}
{{ object }}
{% else %}
Add a Child
{% trans "Add a Child" %}
{% endif %}
{% 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>
{% if object %}
<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 %}
<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 %}
{% endblock %}
{% block content %}
{% if object %}
<h1>Update <span class="text-info">{{ object }}</span></h1>
{% blocktrans %}<h1>Update <span class="text-info">{{ object }}</span></h1>{% endblocktrans %}
{% else %}
<h1>Add a Child</h1>
<h1>{% trans "Add a Child" %}</h1>
{% endif %}
{% include 'babybuddy/form.html' %}
{% endblock %}

View File

@ -1,10 +1,10 @@
{% 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 %}
<li class="breadcrumb-item active" aria-current="page">Children</li>
<li class="breadcrumb-item active" aria-current="page">{% trans "Children" %}</li>
{% endblock %}
{% block content %}
@ -15,10 +15,10 @@
<thead class="thead-inverse">
<tr>
<th class="picture-column"><i class="icon icon-camera" aria-hidden="true"></i></th>
<th>First Name</th>
<th>Last Name</th>
<th>Birth Date</th>
<th class="text-center">Actions</th>
<th>{% trans "First Name" %}</th>
<th>{% trans "Last Name" %}</th>
<th>{% trans "Birth Date" %}</th>
<th class="text-center">{% trans "Actions" %}</th>
</tr>
</thead>
<tbody>
@ -38,7 +38,7 @@
<td>{{ child.last_name }}</td>
<td>{{ child.birth_date }}</td>
<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 %}
<a href="{% url 'core:child-update' child.slug %}" class="btn btn-warning">
@ -57,7 +57,7 @@
</tr>
{% empty %}
<tr>
<th colspan="4">No children found.</th>
<th colspan="4">{% trans "No children found." %}</th>
</tr>
{% endfor %}
</tbody>
@ -67,7 +67,7 @@
{% if perms.core.add_child %}
<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>
{% endif %}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,10 +1,10 @@
{% 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 %}
<li class="breadcrumb-item active" aria-current="page">Sleep</li>
<li class="breadcrumb-item active" aria-current="page">{% trans "Sleep" %}</li>
{% endblock %}
{% block content %}
@ -14,12 +14,12 @@
<table class="table table-striped table-hover">
<thead class="thead-inverse">
<tr>
<th>Child</th>
<th>Duration</th>
<th>Start</th>
<th>End</th>
<th class="text-center">Nap</th>
<th class="text-center">Actions</th>
<th>{% trans "Child" %}</th>
<th>{% trans "Duration" %}</th>
<th>{% trans "Start" %}</th>
<th>{% trans "End" %}</th>
<th class="text-center">{% trans "Nap" %}</th>
<th class="text-center">{% trans "Actions" %}</th>
</tr>
</thead>
<tbody>
@ -31,7 +31,7 @@
<td>{{ sleep.end|date:'n/j/y G:i' }}</td>
<td class="text-center">{{ sleep.nap|bool_icon }}</td>
<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 %}
<a href="{% url 'core:sleep-update' sleep.id %}" class="btn btn-primary">
@ -50,7 +50,7 @@
</tr>
{% empty %}
<tr>
<th colspan="5">No sleep entries found.</th>
<th colspan="5">{% trans "No sleep entries found." %}</th>
</tr>
{% endfor %}
</tbody>
@ -60,7 +60,7 @@
{% if perms.core.add_sleep %}
<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>
{% endif %}

View File

@ -1,19 +1,19 @@
{% 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 %}
<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 active" aria-current="page">Delete</li>
<li class="breadcrumb-item active" aria-current="page">{% trans "Delete" %}</li>
{% endblock %}
{% block content %}
<form role="form" method="post">
{% csrf_token %}
<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1>
<input type="submit" value="Delete" class="btn btn-danger" />
<a href="/" class="btn btn-default">Cancel</a>
{% blocktrans %}<h1>Are you sure you want to delete <span class="text-info">{{ object }}</span>?</h1>{% endblocktrans %}
<input type="submit" value="{% trans "Delete" %}" class="btn btn-danger" />
<a href="/" class="btn btn-default">{% trans "Cancel" %}</a>
</form>
{% endblock %}

View File

@ -1,10 +1,10 @@
{% extends 'babybuddy/page.html' %}
{% load duration timers %}
{% load duration i18n timers %}
{% block title %}{{ object }}{% endblock %}
{% 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>
{% endblock %}
@ -17,34 +17,40 @@
<span class="timer-seconds">{{ object.duration|seconds }}</span>s
</div>
<p class="lead text-secondary">
Started {{ object.start }}
{% trans "Started" %} {{ object.start }}
{% if not object.active %}
/ Stopped {{ object.end }}
/ {% trans "Stopped" %} {{ object.end }}
{% endif %}
</p>
<p class="text-muted">
{{ timer }} created by {{ object.user }}
{% blocktrans %}{{ timer }} created by {{ object.user }}{% endblocktrans %}
</p>
{% if perms.core.add_feeding %}
<a class="btn btn-success btn-lg btn-block mb-3"
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 %}
{% if perms.core.add_sleep %}
<a class="btn btn-success btn-lg btn-block mb-3"
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 %}
{% if perms.core.add_tummytime %}
<a class="btn btn-success btn-lg btn-block mb-3"
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 %}
<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 %}
<a class="btn btn-danger"

View File

@ -1,23 +1,23 @@
{% extends 'babybuddy/page.html' %}
{% load duration %}
{% load duration i18n %}
{% block title %}Timer{% endblock %}
{% block title %}{% trans "Timer" %}{% endblock %}
{% 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 %}
<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 %}
<li class="breadcrumb-item active" aria-current="page">Start</li>
<li class="breadcrumb-item active" aria-current="page">{% trans "Start" %}</li>
{% endif %}
{% endblock %}
{% block content %}
{% if object %}
<h1>Update <span class="text-info">{{ object }}</span></h1>
{% blocktrans %}<h1>Update <span class="text-info">{{ object }}</span></h1>{% endblocktrans %}
{% else %}
<h1>Start Timer</h1>
<h1>{% trans "Start Timer" %}</h1>
{% endif %}
{% include 'babybuddy/form.html' %}
{% endblock %}

View File

@ -1,10 +1,10 @@
{% 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 %}
<li class="breadcrumb-item active" aria-current="page">Timers</li>
<li class="breadcrumb-item active" aria-current="page">{% trans "Timers" %}</li>
{% endblock %}
{% block content %}
@ -14,12 +14,12 @@
<table class="table table-striped table-hover">
<thead class="thead-inverse">
<tr>
<th>Name</th>
<th>Start</th>
<th>Duration</th>
<th>End</th>
<th>Active</th>
<th>User</th>
<th>{% trans "Name" %}</th>
<th>{% trans "Start" %}</th>
<th>{% trans "Duration" %}</th>
<th>{% trans "End" %}</th>
<th>{% trans "Active" %}</th>
<th>{% trans "User" %}</th>
</tr>
</thead>
<tbody>
@ -34,7 +34,7 @@
</tr>
{% empty %}
<tr>
<th colspan="7">No timer entries found.</th>
<th colspan="7">{% trans "No timer entries found." %}</th>
</tr>
{% endfor %}
</tbody>

View File

@ -1,30 +1,34 @@
{% load i18n %}
<li class="nav-item dropdown">
<a id="nav-timer-menu-link"
class="nav-link dropdown-toggle"
href="#"
data-toggle="dropdown"
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">
{% if perms.core.add_timer %}
<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 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>
{% endif %}
{% if perms.core.view_timer %}
<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>
{% endif %}
{% if timers %}
<h6 class="dropdown-header">Active Timers</h6>
<h6 class="dropdown-header">{% trans "Active Timers" %}</h6>
{% for timer in timers %}
<a class="dropdown-item" href="{% url 'core:timer-detail' timer.id %}">{{ timer }} ({{ timer.user }})</a>
{% empty %}
<a class="dropdown-item disabled" href="#">None</a>
<a class="dropdown-item disabled" href="#">{% trans "None" %}</a>
{% endfor %}
{% endif %}
</div>

View File

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

View File

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

View File

@ -1,11 +1,10 @@
{% extends 'babybuddy/page.html' %}
{% load widget_tweaks %}
{% load duration %}
{% load duration i18n widget_tweaks %}
{% block title %}Tummy Time{% endblock %}
{% block title %}{% trans "Tummy Time" %}{% endblock %}
{% 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 %}
{% block content %}
@ -15,12 +14,12 @@
<table class="table table-striped table-hover">
<thead class="thead-inverse">
<tr>
<th>Child</th>
<th>Duration</th>
<th>Start</th>
<th>End</th>
<th>Milestone</th>
<th class="text-center">Actions</th>
<th>{% trans "Child" %}</th>
<th>{% trans "Duration" %}</th>
<th>{% trans "Start" %}</th>
<th>{% trans "End" %}</th>
<th>{% trans "Milestone" %}</th>
<th class="text-center">{% trans "Actions" %}</th>
</tr>
</thead>
<tbody>
@ -32,7 +31,7 @@
<td>{{ tummytime.end|date:'n/j/y G:i' }}</td>
<td>{{ tummytime.milestone }}</td>
<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 %}
<a href="{% url 'core:tummytime-update' tummytime.id %}" class="btn btn-primary">
@ -51,7 +50,7 @@
</tr>
{% empty %}
<tr>
<th colspan="6">No tummy time entries found.</th>
<th colspan="6">{% trans "No tummy time entries found." %}</th>
</tr>
{% endfor %}
</tbody>
@ -61,7 +60,7 @@
{% if perms.core.add_tummytime %}
<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 %}
{% endblock %}

View File

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

View File

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

View File

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

View File

@ -3,6 +3,7 @@ from django.contrib import messages
from django.contrib.messages.views import SuccessMessageMixin
from django.urls import reverse, reverse_lazy
from django.utils import timezone
from django.utils.translation import gettext as _
from django.views.generic.base import RedirectView
from django.views.generic.detail import DetailView
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):
cleaned_data['model'] = self.model._meta.verbose_name.title()
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:
self.success_message = '%(model)s entry added!'
self.success_message = _('%(model)s entry added!')
return self.success_message % cleaned_data
@ -27,9 +28,9 @@ class CoreUpdateView(PermissionRequired403Mixin, SuccessMessageMixin,
def get_success_message(self, cleaned_data):
cleaned_data['model'] = self.model._meta.verbose_name.title()
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:
self.success_message = '%(model)s entry updated.'
self.success_message = _('%(model)s entry updated.')
return self.success_message % cleaned_data
@ -58,7 +59,7 @@ class ChildAdd(CoreAddView):
permission_required = ('core.add_child',)
form_class = forms.ChildForm
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):
@ -286,7 +287,7 @@ class TimerRestart(PermissionRequired403Mixin, RedirectView):
class TimerStop(PermissionRequired403Mixin, SuccessMessageMixin, RedirectView):
permission_required = ('core.change_timer',)
success_message = '%(timer)s stopped.'
success_message = _('%(timer)s stopped.')
def get(self, request, *args, **kwargs):
instance = models.Timer.objects.get(id=kwargs['pk'])