-
Notifications
You must be signed in to change notification settings - Fork 9
i18n finished #261
base: master
Are you sure you want to change the base?
i18n finished #261
Conversation
{% load bootstrap3 %} | ||
|
||
{% block title %} | ||
{{ note_type }} {{ patient.name }} | ||
{% endblock %} | ||
|
||
{% block header %} | ||
<h1>New {{ note_type }} </h1> | ||
<h1>{% trans "New" context "neuer" %} {{ note_type }} </h1> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
@@ -1,4 +1,5 @@ | |||
[ | |||
{% load i18n %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work?! I would expect the json parser to choke on this. Does it actually respect the template language?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left this one in the json file by mistake. It's wrong, you are right.
@@ -45,7 +52,7 @@ def make_filepath(instance, filename): | |||
|
|||
|
|||
class ContactMethod(models.Model): | |||
'''Simple text-contiaining class for storing the method of contacting a | |||
'''Simple text-contsaining class for storing the method of contacting a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be "text-containing"
|
||
|
||
pcp_preferred_zip = models.CharField(max_length=5, | ||
validators=[validators.validate_zip], | ||
blank=True, | ||
null=True) | ||
null=True, verbose_name=_("pcp preferred zip")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this create the need for a database migration? What happens when you run manage.py makemigrations
?
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty surprised you have changes here to the minified bootstrap code. Is this just your editor being a bit enthusiastic about formatting things?
@@ -38,6 +40,7 @@ | |||
body { | |||
padding-top: 50px; | |||
padding-bottom: 5%; | |||
background-color: rgb(238, 242, 245) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the addition of a background color here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've played around a little with the design, this can be deleted and slipped into the commit by mistake
"ReferralStatus" -> "Referral Status"
<p><a href="{% url 'followup' pk=note.pk model=note.type %}"><strong>{{ note.type }} Followup:</strong></a> {{ note.short_text }}</p> | ||
<p class="text-muted text-right">by {{ note.author }} ({{ note.author_type }}) at {{ note.written_datetime }}</p> | ||
<p><a href="{% url 'followup' pk=note.pk model=note.type %}"><strong>{{ note.type }} {% trans 'Followup' %}:</strong></a> {{ note.short_text }}</p> | ||
<p class="text-muted text-right">{% trans 'by' %} {{ note.author }} ({{ note.author_type }}) {% trans 'at' %} {{ note.written_datetime }}</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we have a {% trans 'by' %}
do we ever have to worry about the word "by" translating to different things? Like a note by me is "von mir" but if you say you're standing by me you stand "neben mir". See what I mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's right! As I've mentioned in another comment there is a "context"-option, that helps to solve this problem. This should be used whenever there are words with multiple translations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Let's discuss the need for changes to the boostrap css
- I want to make sure we're not affecting database structure with the translation
- We may need to look into contextual markers for some things, such as the use of the word "by" for authorship.
- The appearance of
<!-- trans finished -->
after the loading of the i18n tags seems like it has the potential to confuse future developers. - There are several places where
{% blocktrans %}{% endblocktrans %}
directives are used where{% trans 'variable' %}
directives seem like they'd be more concise. - A few miscellaneous things.
|
||
|
||
class FollowupRequestForm(ModelForm): | ||
class Meta: | ||
model = models.FollowupRequest | ||
fields = ['due_date', 'contact_instructions'] | ||
widgets = {'due_date': DateTimePicker( | ||
options={"format": "MM/DD/YYYY"})} | ||
options={"format": _("MM/DD/YYYY")})} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you translate this, do you change it to European style ("DD/MM/YYYY")? If so, internal logic will likely need to change.
(STATUS_UNSUCCESSFUL, 'Unsuccessful'), | ||
(STATUS_SUCCESSFUL, _('Successful')), | ||
(STATUS_PENDING, _('Pending')), | ||
(STATUS_UNSUCCESSFUL, _('Unsuccessful')), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this change the database? (I don't think so, I think that's what STATUS_PENDING
does, but I'm not sure.)
@@ -1,13 +1,16 @@ | |||
{% extends "pttrack/base.html" %} | |||
|
|||
{% load i18n %} | |||
<!-- trans finished --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of this comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be deleted, it was just so that I'm sure that I've already finished the translation of that particular file.
{% endif %} | ||
<p class="lead">Referral to | ||
<p class="lead">{% blocktrans %}Referral to{% endblocktrans %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the blocktrans
directive supports putting django template language stuff inside it, so you could have this be all one big blocktrans, no?
@@ -28,7 +31,7 @@ <h1>New referral followup</h1> | |||
<div class="container"> | |||
<div class="row"> | |||
<div class='col-md-offset-2 col-md-8' style='padding-bottom: 2em'> | |||
<p>A referral is considered <strong><span class='text-success'>successful</span> only once a patient has both made <i>and gone to</i> and appointment</strong>. Please <strong><span class='text-info'>continue following up</span></strong> with patients until they have completed an appointment. Only once you have exhausted followup should you save as an <strong><span class="text-danger">unsuccessful referral.</span></strong></p> | |||
<p>{% blocktrans %}A referral is considered{% endblocktrans %} <strong><span class='text-success'>{% blocktrans %}successful{% endblocktrans %}</span> {% blocktrans %}only once a patient has both made{% endblocktrans %} <i>{% blocktrans %}and gone to{% endblocktrans %}</i> {% blocktrans %}and appointment{% endblocktrans %}</strong>. {% blocktrans %}Please{% endblocktrans %} <strong><span class='text-info'>{% blocktrans %}continue following up{% endblocktrans %}</span></strong> {% blocktrans %}with patients until they have completed an appointment{% endblocktrans %}. {% blocktrans %}Only once you have exhausted followup should you save as an{% endblocktrans %} <strong><span class="text-danger">{% blocktrans %}unsuccessful referral{% endblocktrans %}.</span></strong></p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is quite verbose--there are a lot of blocktrans
s in here... is there really no way to have it just be one block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to try that one out. But as far as I remember the html-tags inside the blocktrans
tags are slipping into the translation, this can be confusing and could lead to errors while translating (e.g. not closing the tag in the right manner).
{% endblock %} | ||
|
||
{% block content %} | ||
|
||
<div class="container text-center"> | ||
<div class="btn-group-vertical"> | ||
{% for referral_type in referral_types %} | ||
<a class="btn btn-{% cycle 'info' 'success' 'warning' 'danger' %}" href="{% url 'new-referral' rtype=referral_type.slugify pt_id=pt.pk %}" role="button">Create {{referral_type}} referral</a> | ||
<a class="btn btn-{% cycle 'info' 'success' 'warning' 'danger' %}" href="{% url 'new-referral' rtype=referral_type.slugify pt_id=pt.pk %}" role="button">{% blocktrans %}Create{% endblocktrans %} {{referral_type}} {% blocktrans %}referral{% endblocktrans %}</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I've understood the blocktrans
docs correctly, you can do:
{% blocktrans %}Create {{referral_type}} referral{% endblocktrans %}
instead of what you have here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, didn't catch that one
@@ -2,6 +2,7 @@ Django==1.11.23 | |||
django-bootstrap3==11.0.0 | |||
git+https://github.com/inducer/django-bootstrap3-datetimepicker.git | |||
django-crispy-forms==1.7.2 | |||
django-debug-toolbar==1.11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did this get in here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First time I started Osler in a Virtual Environment it threw an error that said missing django-debug-toolbar. I've added it in requirements.txt, probably I've didn't use the developer mode.
<div class="col-md-6 col-md-offset-3 custom-table-outer"> | ||
<table class="table custom-table" style="text-align: center"> | ||
<tr><th class="custom-table-inner" style="text-align: center"><h4 class="h4-custom">{% trans 'Note Type' %}</h4> | ||
<p class="p-custom">Wähle hier die Untersuchungsform aus, die für diesen Patienten angelegt werden soll.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was geht denn heir ab? Falsche sprache?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, wrong language. This can be deleted, I've added it for explaining what "Note type" means (students who use the Osler for the first time may have no idea what is meant by "Note type").
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<h4>Physical Exam</h4> | ||
<h4>{% blocktrans %}Physical Exam{% endblocktrans %}</h4> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many of these would be more concisely represented with as {% trans 'string' %}
blocks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've also thought about that. Especially when using long phrases and when inserting special characters like apostrophes using {% trans 'string' %}
is throwing errors.
Hey there,
I've finished i18n of Osler. There should be a way of configuring the language on the first setup of Osler. For now the language will be configured in base_settings.py.