Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

i18n finished #261

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
495 changes: 494 additions & 1 deletion api/fixtures/api.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion appointment/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit
from bootstrap3_datetime.widgets import DateTimePicker
from django.utils.translation import gettext as _

from .models import Appointment

Expand All @@ -21,4 +22,4 @@ class Meta:
def __init__(self, *args, **kwargs):
super(AppointmentForm, self).__init__(*args, **kwargs)
self.helper = FormHelper(self)
self.helper.add_input(Submit('submit', 'Submit'))
self.helper.add_input(Submit('submit', _('Submit')))
15 changes: 8 additions & 7 deletions appointment/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django.core.exceptions import ValidationError
from django.conf import settings
from pttrack.models import Note
from django.utils.translation import gettext as _

from simple_history.models import HistoricalRecords

Expand Down Expand Up @@ -31,19 +32,19 @@ class Meta:
(VACCINE, "Vaccine Followup")
)

clindate = models.DateField(verbose_name="Appointment Date")
clindate = models.DateField(verbose_name=_("Appointment Date"))
clintime = models.TimeField(
verbose_name="Time of Appointment",
verbose_name=_("Time of Appointment"),
default=generate_default_appointment_time)
appointment_type = models.CharField(
max_length=15, choices=APPOINTMENT_TYPES,
verbose_name='Appointment Type', default=CHRONIC_CARE)
comment = models.TextField(
help_text="What should happen at this appointment?")
verbose_name=_('Appointment Type'), default=CHRONIC_CARE)
comment = models.TextField(verbose_name=_('Comment'),
help_text=_("What should happen at this appointment?"))

pt_showed = models.NullBooleanField(
verbose_name="Patient Showed",
blank=True, help_text="Did the patient come to this appointment?")
verbose_name=_("Patient Showed"),
blank=True, help_text=_("Did the patient come to this appointment?"))

history = HistoricalRecords()

Expand Down
15 changes: 9 additions & 6 deletions appointment/templates/appointment/appointment_list.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{% extends "pttrack/base.html" %}

{% load i18n %}
<!-- trans NOT finished -->

{% load bootstrap3 %}

{% block title %}
Appointment List
{% blocktrans %}Appointment List{% endblocktrans %}
{% endblock %}

{% block header %}
<div class="container">
<h1>Appointment List</h1>
<h1>{% blocktrans %}Appointment List{% endblocktrans %}</h1>
</div>

{% endblock %}
Expand All @@ -26,7 +29,7 @@ <h3 style="display: inline" class="panel-title">{{ date | date:"l F d, Y" }}</h
</div>
<table class="table" name="appointment-table-{{forloop.counter0}}">
<tr>
<th>Time</th><th>Patient</th><th>Type</th>
<th>{% blocktrans %}Time{% endblocktrans %}</th><th>{% blocktrans %}Patient{% endblocktrans %}</th><th>{% blocktrans %}Type{% endblocktrans %}</th>
</tr>
{% with forloop.first as first_apt %}
{% for app in app_list %}
Expand All @@ -43,16 +46,16 @@ <h3 style="display: inline" class="panel-title">{{ date | date:"l F d, Y" }}</h
<p style="margin-left: 5%; margin-right: 5%"><i>{{ app.comment }}</i></p>
<p style="margin-left: 5%; margin-right: 5%; text-align: right;">
<a class="btn btn-xs btn-default" href="{% url 'appointment-update' pk=app.id %}">
<span class="glyphicon glyphicon-pencil"></span>&nbsp;edit
<span class="glyphicon glyphicon-pencil"></span>&nbsp;{% blocktrans %}edit{% endblocktrans %}
</a>
{% if app.pt_showed == None and first_apt %}
<a class="btn btn-xs btn-danger" href="{% url 'appointment-mark-no-show' pk=app.id %}"
onclick="return confirm('Mark this patient as a not coming?')">
<span class="glyphicon glyphicon-ban-circle"></span>&nbsp;no show
<span class="glyphicon glyphicon-ban-circle"></span>&nbsp;{% blocktrans %}no show{% endblocktrans %}
</a>
<a class="btn btn-xs btn-success" href="{% url 'appointment-mark-arrived' pk=app.id %}"
onclick="return confirm('Mark this patient as a here?')">
<span class="glyphicon glyphicon glyphicon-ok"></span>&nbsp;arrived
<span class="glyphicon glyphicon glyphicon-ok"></span>&nbsp;{% blocktrans %}arrived{% endblocktrans %}
</a>
{% endif %}
</p>
Expand Down
4 changes: 3 additions & 1 deletion appointment/templates/appointment/form_submission.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{% extends "pttrack/base-form.html" %}

{% load i18n %}
<!-- trans finished -->
{% load bootstrap3 %}

{% block title %}
{{ note_type }} {{ patient.name }}
{% endblock %}

{% block header %}
<h1>New {{ note_type }} </h1>
<h1>{% trans "New" context "neuer" %} {{ note_type }} </h1>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's going on in this line? I'm surprised to see any non-base language words (in this case "neuer")... is that necessary?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are context based translations. You are right, there should be a better way than to write it down in german! Basically this tells the i18n script that this word "new" can have different meanings or translations in german (e.g. it could translate to "neu" oder "neuer"). I try to think about a better way to implement this.

{% endblock %}

{% block content %}
Expand Down
5 changes: 3 additions & 2 deletions appointment/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from .models import Appointment
from .forms import AppointmentForm

from django.utils.translation import gettext as _

def list_view(request):

Expand Down Expand Up @@ -53,13 +54,13 @@ class AppointmentUpdate(NoteUpdate):
template_name = "pttrack/form-update.html"
model = Appointment
form_class = AppointmentForm
note_type = "Appointment"
note_type = _("Appointment")
success_url = "/appointment/list"


class AppointmentCreate(NoteFormView):
template_name = 'appointment/form_submission.html'
note_type = "Appointment"
note_type = _("Appointment")
form_class = AppointmentForm
success_url = "list"

Expand Down
3 changes: 2 additions & 1 deletion demographics/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, Fieldset
from bootstrap3_datetime.widgets import DateTimePicker
from django.utils.translation import gettext as _

from . import models

Expand Down Expand Up @@ -38,4 +39,4 @@ def __init__(self, *args, **kwargs):
'annual_income')
)

self.helper.add_input(Submit('submit', 'Submit'))
self.helper.add_input(Submit('submit', _('Submit')))
8 changes: 4 additions & 4 deletions demographics/templates/demographics/demographics-create.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "pttrack/base.html" %}

{% load i18n %}
{% block title %}
{% if patient %}
{{ patient.name }}
Expand All @@ -9,11 +9,11 @@
{% endblock %}

{% block header %}
<h1>New Survey </h1>
<h1>{% trans 'New Survey' %} </h1>
{% if patient %}
<p class="lead">Demographics for <em><a href="{% url 'patient-detail' pk=patient.id %}">{{ patient.name }}</a></em></p>
<p class="lead">{% trans 'Demographics for'%} <strong><a href="{% url 'patient-detail' pk=patient.id %}">{{ patient.name }}</a></strong></p>
{% else %}
<p class="lead">Demographics for <em><a href="{% url 'patient-detail' pk=demographics.patient.id %}">{{ demographics.patient.name }}</a></em></p>
<p class="lead">{% trans 'Demographics for'%} <strong><a href="{% url 'patient-detail' pk=demographics.patient.id %}">{{ demographics.patient.name }}</a></strong></p>
{% endif %}
{% endblock %}

Expand Down
6 changes: 3 additions & 3 deletions demographics/templates/demographics/demographics-resolve.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% extends "pttrack/base.html" %}

{% load i18n %}
{% block header %}
<h1>Warning: Patient already has Demographics information</h1>
<p class="lead">Please review differences and submit a single form for <em><a href="{% url 'patient-detail' pk=pt_id %}">{{ pt_name }}</a></em></p>
<h1>{% trans 'Warning: Patient already has Demographics information' %}</h1>
<p class="lead">{% trans 'Please review differences and submit a single form for' %} <em><a href="{% url 'patient-detail' pk=pt_id %}">{{ pt_name }}</a></em></p>
{% endblock %}


Expand Down
62 changes: 31 additions & 31 deletions demographics/templates/demographics/demographics_detail.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{% extends "pttrack/base.html" %}

{% load i18n %}
{% block title %}
Demographic Data: {{ demographics.patient.name }}
{% trans 'Demographic Data'%}: {{ demographics.patient.name }}
{% endblock %}

{% block header %}
<div class="row">
<div class="col-md-4">
<h1>Demographic Survey Data</h1>
<p class="lead">For <a href="{% url 'patient-detail' pk=demographics.patient.id %}">{{ demographics.patient.name }}</a></p>
<h1>{% trans 'Demographic Survey Data'%}</h1>
<p class="lead">{% trans 'For' %} <a href="{% url 'patient-detail' pk=demographics.patient.id %}">{{ demographics.patient.name }}</a></p>
</div>
<div class="col-md-1 pull-right">
<h1><a href="{% url 'demographics-update' pk=demographics.id %}">
Expand All @@ -21,82 +21,82 @@ <h1><a href="{% url 'demographics-update' pk=demographics.id %}">
{% block content %}
<div class="container">
<div class="row">
<h4>Medical</h4>
<h4>{% trans 'Medical' %}</h4>
<div class="col-md-12">
<strong>Has Insurance: </strong>
<strong>{% trans 'Has Insurance'%}: </strong>
{% if demographics.has_insurance %}
Yes
{% trans 'Yes' %}
{% elif demographics.has_insurance != None %}
No
{% trans 'No' %}
{% elif demographics.has_insurance == None %}
Not Answered
{% trans 'Not Answered' %}
{% endif %}
</div>
<div class="col-md-12">
<strong>ER Visit in Last Year: </strong>
<strong>{% trans 'ER Visit in the last year' %}: </strong>
{% if demographics.ER_visit_last_year %}
Yes
{% trans 'Yes' %}
{% elif demographics.ER_visit_last_year != None %}
No
{% trans 'No' %}
{% elif demographics.ER_visit_last_year == None %}
Not Answered
{% trans 'Not Answered' %}
{% endif %}
</div>
<div class="col-md-12">
<strong>Last Date Visited Physician:</strong> {{ demographics.last_date_physician_visit }}
<strong>{% trans 'Last Date visited Physician' %}:</strong> {{ demographics.last_date_physician_visit }}
</div>
<div class="col-md-12">
<strong>Chronic Conditions: </strong>
<strong>{% trans 'Chronic Conditions' %}: </strong>
{% for condition in demographics.chronic_condition.all %}
{{ condition }}
{% endfor %}
</div>
</div>
<div class="row">
<h4>Social</h4>
<h4>{% trans 'Social' %}</h4>
<div class="col-md-12">
<strong>Lives Alone: </strong>
<strong>{% trans 'Lives Alone' %}: </strong>
{% if demographics.lives_alone %}
Yes
{% trans 'Yes' %}
{% elif demographics.lives_alone != None %}
No
{% trans 'No' %}
{% elif demographics.lives_alone == None %}
Not Answered
{% trans 'Not Answered' %}
{% endif %}
</div>
<div class="col-md-12">
<strong>Number of Dependents: </strong> {{ dependents }}
<strong>{% trans 'Number of Dependents' %}: </strong> {{ dependents }}
</div>
<div class="col-md-12">
<strong>Transportation: </strong> {{ demographics.transportation }}
<strong>{% trans 'Transportation' %}: </strong> {{ demographics.transportation }}
</div>
<div class="col-md-12">
<strong>Resource Access:</strong>
<strong>{% trans 'Resource Access' %}:</strong>
{% for resource in demographics.resource_access.all %}
{{ resource }}
{% endfor %}
</div>
</div>
<div class="row">
<h4>Employment</h4>
<h4>{% trans 'Employment' %}</h4>
<div class="col-md-12">
<strong>Education Level:</strong> {{ demographics.education_level }}
<strong>{% trans 'Education Level' %}:</strong> {{ demographics.education_level }}
</div>
<div class="col-md-12">
<strong>Currently Employed: </strong>
<strong>{% trans 'Currently Employed' %}: </strong>
{% if demographics.currently_employed %}
Yes
{% trans 'Yes' %}
{% elif demographics.currently_employed != None %}
No
{% trans 'No' %}
{% elif demographics.currently_employed == None %}
Not Answered
{% trans 'Not Answered' %}
{% endif %}
</div>
<div class="col-md-12">
<strong>Work Status:</strong> {{ demographics.work_status }}
<strong>{% trans 'Work Status' %}:</strong> {{ demographics.work_status }}
</div>
<div class="col-md-12">
<strong>Annual Income:</strong> {{ demographics.annual_income }}
<strong>{% trans 'Annual Income' %}:</strong> {{ demographics.annual_income }}
</div>
</div>
</div>
Expand Down
Loading