Template internationalization

This commit is contained in:
Andrew Ingram 2013-05-25 18:44:48 +01:00
parent 906b8cbf4e
commit a4d77a9309
7 changed files with 28 additions and 27 deletions

View file

@ -55,7 +55,7 @@
<div class="container-fluid">
<div class="row">
<div class="span10">
<h3>{% block page_title %}Site administration{% endblock %}</h3>
<h3>{% block page_title %}{% trans "Site administration" %}{% endblock %}</h3>
</div>
</div>
{% block content %}{% endblock %}

View file

@ -1,8 +1,8 @@
{% extends "admin2/bootstrap/base.html" %}
{% load i18n %}
{% block content %}
<p>Are you sure you want to delete the selected {{ objects_name }}?</p>
<p>{% blocktrans with objects_name=objects_name %}Are you sure you want to delete the selected {{ objects_name }}?{% endblocktrans %}</p>
<ul>
{% for item in queryset %}

View file

@ -1,5 +1,5 @@
{% extends "admin2/bootstrap/base.html" %}
{% load admin2_tags %}
{% load admin2_tags i18n %}
{% block content %}
@ -26,15 +26,14 @@
{# if has_add_permission #}
<a href="{% url model_admin|admin2_urlname:'create' %}">
<i class="icon-plus"></i>
Add
{% trans "Add" %}
</a>
{# endif #}
</td>
<td class="text-right">
<a href="{{ model_admin.get_index_url }}">
<i class="icon-pencil"></i>
Change
{% trans "Change" %}
</a>
</td>
</tr>
@ -44,8 +43,8 @@
{% endfor %}
</div>
<div class="span5">
<h4>Recent Actions</h4>
<h5>My Actions</h5>
<h4>{% trans "Recent Actions" %}</h4>
<h5>{% trans "My Actions" %}</h5>
TODO
</div>
</div>

View file

@ -1,11 +1,12 @@
{% extends "admin2/bootstrap/base.html" %}
{% load i18n %}
{% block title %}Are you sure?{% endblock %}
{% block title %}{% trans "Are you sure?" %}{% endblock %}
{% block page_title %}Are you sure?{% endblock %}
{% block page_title %}{% trans "Are you sure?" %}{% endblock %}
{% block content %}
<p>Are you sure you want to delete the {{ model }} "{{ object }}"? All of the following related items will be deleted:</p>
<p>{% blocktrans with model=model object=object %}Are you sure you want to delete the {{ model }} "{{ object }}"? All of the following related items will be deleted:{% endblocktrans %}</p>
TODO

View file

@ -1,9 +1,9 @@
{% extends "admin2/bootstrap/base.html" %}
{% load admin2_tags %}
{% load admin2_tags i18n %}
{% block title %}Select {{ model|model_verbose_name }} to change{% endblock %}
{% block title %}{% blocktrans with model_verbose_name=model|model_verbose_name %}Select {{ model_verbose_name }} to change{% endblocktrans %}{% endblock %}
{% block page_title %}Select {{ model|model_verbose_name }} to change{% endblock %}
{% block page_title %}{% blocktrans with model_verbose_name=model|model_verbose_name %}Select {{ model_verbose_name }} to change{% endblocktrans %}{% endblock %}
{% block extrajs %}
<script src="/static/themes/bootstrap/js/actions.js"></script>
@ -25,7 +25,7 @@
<span id="selected-count">0</span> of {{ object_list|length }} selected
<div class="pull-right">
{# if has_add_permission #}
<a href="{% url view|admin2_urlname:'create' %}" class="btn"><i class="icon-plus"></i> Add {{ model|model_verbose_name }}</a>
<a href="{% url view|admin2_urlname:'create' %}" class="btn"><i class="icon-plus"></i> {% blocktrans with model_verbose_name=model|model_verbose_name %}Add {{ model_verbose_name }}{% endblocktrans %}</a>
{# endif #}
</div>
</div>
@ -40,12 +40,13 @@
<tr>
<td><input type="checkbox" class="model-select" name="selected_model_pk" value="{{ obj.pk }}"></td>
<td>
{{ obj }} <a href="{% url view|admin2_urlname:'detail' pk=obj.pk %}">detail</a>
{{ obj }}
<a href="{% url view|admin2_urlname:'detail' pk=obj.pk %}">{% trans "Detail" %}</a>
{# if has_edit_permission #}
<a href="{% url view|admin2_urlname:'update' pk=obj.pk %}">edit</a>
<a href="{% url view|admin2_urlname:'update' pk=obj.pk %}">{% trans "Edit" %}</a>
{# endif #}
{# if has_delete_permission #}
<a href="{% url view|admin2_urlname:'delete' pk=obj.pk %}">delete</a>
<a href="{% url view|admin2_urlname:'delete' pk=obj.pk %}">{% trans "Delete" %}</a>
{# endif #}
</td>
</tr>
@ -53,7 +54,7 @@
</tbody>
</table>
{{ object_list|length }} {{ model|model_verbose_name }}
{{ object_list|length }} {{ model|model_verbose_name_plural }}
</div>
</form>
</div>

View file

@ -1,10 +1,10 @@
{% extends "admin2/bootstrap/base.html" %}
{% load admin2_tags %}
{% load admin2_tags i18n %}
{% block title %}{{ action }} {{ model|model_verbose_name }}{% endblock %}
{% block title %}{% blocktrans with action=action model_verbose_name=model|model_verbose_name %}{{ action }} {{ model_verbose_name }}{% endblocktrans %}{% endblock %}
{% block page_title %}{{ action }} {{ model|model_verbose_name }}{% endblock %}
{% block page_title %}{% blocktrans with action=action model_verbose_name=model|model_verbose_name %}{{ action }} {{ model_verbose_name }}{% endblocktrans %}{% endblock %}
{% block content %}
@ -44,9 +44,9 @@
</table>
{% endfor %}
<button class="btn btn-small" type="submit" name="_addanother">Save and add another</button>
<button class="btn btn-small" type="submit" name="_continue">Save and continue editing</button>
<button class="btn btn-small btn-success" type="submit" name="_save">Save</button>
<button class="btn btn-small" type="submit" name="_addanother">{% trans "Save and add another" %}</button>
<button class="btn btn-small" type="submit" name="_continue">{% trans "Save and continue editing" %}</button>
<button class="btn btn-small btn-success" type="submit" name="_save">{% trans "Save" %}</button>
</form>
</div>
</div>

View file

@ -26,7 +26,7 @@ def model_verbose_name_plural(obj):
"""
Returns the pluralized verbose name of a model instance or class.
"""
utils.model_verbose_name_plural(obj)
return utils.model_verbose_name_plural(obj)
@register.filter