diff --git a/django/contrib/admin/templates/admin/404.html b/django/contrib/admin/templates/admin/404.html index 57b6d33780..19f07492cb 100644 --- a/django/contrib/admin/templates/admin/404.html +++ b/django/contrib/admin/templates/admin/404.html @@ -1,12 +1,12 @@ {% extends "admin/base_site.html" %} {% load i18n %} -{% block title %}{% trans 'Page not found' %}{% endblock %} +{% block title %}{% translate 'Page not found' %}{% endblock %} {% block content %} -<h2>{% trans 'Page not found' %}</h2> +<h2>{% translate 'Page not found' %}</h2> -<p>{% trans 'We’re sorry, but the requested page could not be found.' %}</p> +<p>{% translate 'We’re sorry, but the requested page could not be found.' %}</p> {% endblock %} diff --git a/django/contrib/admin/templates/admin/500.html b/django/contrib/admin/templates/admin/500.html index 89a6f65b38..b5ac5c3b6c 100644 --- a/django/contrib/admin/templates/admin/500.html +++ b/django/contrib/admin/templates/admin/500.html @@ -3,15 +3,15 @@ {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> -› {% trans 'Server error' %} +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> +› {% translate 'Server error' %} </div> {% endblock %} -{% block title %}{% trans 'Server error (500)' %}{% endblock %} +{% block title %}{% translate 'Server error (500)' %}{% endblock %} {% block content %} -<h1>{% trans 'Server Error <em>(500)</em>' %}</h1> -<p>{% trans 'There’s been an error. It’s been reported to the site administrators via email and should be fixed shortly. Thanks for your patience.' %}</p> +<h1>{% translate 'Server Error <em>(500)</em>' %}</h1> +<p>{% translate 'There’s been an error. It’s been reported to the site administrators via email and should be fixed shortly. Thanks for your patience.' %}</p> {% endblock %} diff --git a/django/contrib/admin/templates/admin/actions.html b/django/contrib/admin/templates/admin/actions.html index ef2232e13f..b912d37396 100644 --- a/django/contrib/admin/templates/admin/actions.html +++ b/django/contrib/admin/templates/admin/actions.html @@ -5,7 +5,7 @@ {% for field in action_form %}{% if field.label %}<label>{{ field.label }} {% endif %}{{ field }}{% if field.label %}</label>{% endif %}{% endfor %} {% endblock %} {% block actions-submit %} - <button type="submit" class="button" title="{% trans "Run the selected action" %}" name="index" value="{{ action_index|default:0 }}">{% trans "Go" %}</button> + <button type="submit" class="button" title="{% translate "Run the selected action" %}" name="index" value="{{ action_index|default:0 }}">{% translate "Go" %}</button> {% endblock %} {% block actions-counter %} {% if actions_selection_counter %} @@ -13,9 +13,9 @@ {% if cl.result_count != cl.result_list|length %} <span class="all">{{ selection_note_all }}</span> <span class="question"> - <a href="#" title="{% trans "Click here to select the objects across all pages" %}">{% blocktrans with cl.result_count as total_count %}Select all {{ total_count }} {{ module_name }}{% endblocktrans %}</a> + <a href="#" title="{% translate "Click here to select the objects across all pages" %}">{% blocktranslate with cl.result_count as total_count %}Select all {{ total_count }} {{ module_name }}{% endblocktranslate %}</a> </span> - <span class="clear"><a href="#">{% trans "Clear selection" %}</a></span> + <span class="clear"><a href="#">{% translate "Clear selection" %}</a></span> {% endif %} {% endif %} {% endblock %} diff --git a/django/contrib/admin/templates/admin/app_index.html b/django/contrib/admin/templates/admin/app_index.html index 6868b497dd..886bf6ca00 100644 --- a/django/contrib/admin/templates/admin/app_index.html +++ b/django/contrib/admin/templates/admin/app_index.html @@ -6,7 +6,7 @@ {% if not is_popup %} {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> › {% for app in app_list %} {{ app.name }} diff --git a/django/contrib/admin/templates/admin/auth/user/add_form.html b/django/contrib/admin/templates/admin/auth/user/add_form.html index f12c66e30d..61cf5b1b40 100644 --- a/django/contrib/admin/templates/admin/auth/user/add_form.html +++ b/django/contrib/admin/templates/admin/auth/user/add_form.html @@ -3,8 +3,8 @@ {% block form_top %} {% if not is_popup %} - <p>{% trans 'First, enter a username and password. Then, you’ll be able to edit more user options.' %}</p> + <p>{% translate 'First, enter a username and password. Then, you’ll be able to edit more user options.' %}</p> {% else %} - <p>{% trans "Enter a username and password." %}</p> + <p>{% translate "Enter a username and password." %}</p> {% endif %} {% endblock %} diff --git a/django/contrib/admin/templates/admin/auth/user/change_password.html b/django/contrib/admin/templates/admin/auth/user/change_password.html index e2cacf88ef..2d723cf0d6 100644 --- a/django/contrib/admin/templates/admin/auth/user/change_password.html +++ b/django/contrib/admin/templates/admin/auth/user/change_password.html @@ -10,11 +10,11 @@ {% if not is_popup %} {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> › <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a> › <a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a> › <a href="{% url opts|admin_urlname:'change' original.pk|admin_urlquote %}">{{ original|truncatewords:"18" }}</a> -› {% trans 'Change password' %} +› {% translate 'Change password' %} </div> {% endblock %} {% endif %} @@ -25,11 +25,11 @@ {% if is_popup %}<input type="hidden" name="_popup" value="1">{% endif %} {% if form.errors %} <p class="errornote"> - {% if form.errors.items|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %} + {% if form.errors.items|length == 1 %}{% translate "Please correct the error below." %}{% else %}{% translate "Please correct the errors below." %}{% endif %} </p> {% endif %} -<p>{% blocktrans with username=original %}Enter a new password for the user <strong>{{ username }}</strong>.{% endblocktrans %}</p> +<p>{% blocktranslate with username=original %}Enter a new password for the user <strong>{{ username }}</strong>.{% endblocktranslate %}</p> <fieldset class="module aligned"> @@ -52,7 +52,7 @@ </fieldset> <div class="submit-row"> -<input type="submit" value="{% trans 'Change password' %}" class="default"> +<input type="submit" value="{% translate 'Change password' %}" class="default"> </div> </div> diff --git a/django/contrib/admin/templates/admin/base.html b/django/contrib/admin/templates/admin/base.html index 2cf5137070..8d6425ad04 100644 --- a/django/contrib/admin/templates/admin/base.html +++ b/django/contrib/admin/templates/admin/base.html @@ -32,23 +32,23 @@ {% if has_permission %} <div id="user-tools"> {% block welcome-msg %} - {% trans 'Welcome,' %} + {% translate 'Welcome,' %} <strong>{% firstof user.get_short_name user.get_username %}</strong>. {% endblock %} {% block userlinks %} {% if site_url %} - <a href="{{ site_url }}">{% trans 'View site' %}</a> / + <a href="{{ site_url }}">{% translate 'View site' %}</a> / {% endif %} {% if user.is_active and user.is_staff %} {% url 'django-admindocs-docroot' as docsroot %} {% if docsroot %} - <a href="{{ docsroot }}">{% trans 'Documentation' %}</a> / + <a href="{{ docsroot }}">{% translate 'Documentation' %}</a> / {% endif %} {% endif %} {% if user.has_usable_password %} - <a href="{% url 'admin:password_change' %}">{% trans 'Change password' %}</a> / + <a href="{% url 'admin:password_change' %}">{% translate 'Change password' %}</a> / {% endif %} - <a href="{% url 'admin:logout' %}">{% trans 'Log out' %}</a> + <a href="{% url 'admin:logout' %}">{% translate 'Log out' %}</a> {% endblock %} </div> {% endif %} @@ -58,7 +58,7 @@ <!-- END Header --> {% block breadcrumbs %} <div class="breadcrumbs"> - <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> + <a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> {% if title %} › {{ title }}{% endif %} </div> {% endblock %} diff --git a/django/contrib/admin/templates/admin/change_form.html b/django/contrib/admin/templates/admin/change_form.html index f99936d21f..f1f317806d 100644 --- a/django/contrib/admin/templates/admin/change_form.html +++ b/django/contrib/admin/templates/admin/change_form.html @@ -15,10 +15,10 @@ {% if not is_popup %} {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> › <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a> › {% if has_view_permission %}<a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a>{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %} -› {% if add %}{% blocktrans with name=opts.verbose_name %}Add {{ name }}{% endblocktrans %}{% else %}{{ original|truncatewords:"18" }}{% endif %} +› {% if add %}{% blocktranslate with name=opts.verbose_name %}Add {{ name }}{% endblocktranslate %}{% else %}{{ original|truncatewords:"18" }}{% endif %} </div> {% endblock %} {% endif %} @@ -40,7 +40,7 @@ {% if save_on_top %}{% block submit_buttons_top %}{% submit_row %}{% endblock %}{% endif %} {% if errors %} <p class="errornote"> - {% if errors|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %} + {% if errors|length == 1 %}{% translate "Please correct the error below." %}{% else %}{% translate "Please correct the errors below." %}{% endif %} </p> {{ adminform.form.non_field_errors }} {% endif %} diff --git a/django/contrib/admin/templates/admin/change_form_object_tools.html b/django/contrib/admin/templates/admin/change_form_object_tools.html index 32487493a2..067ae83761 100644 --- a/django/contrib/admin/templates/admin/change_form_object_tools.html +++ b/django/contrib/admin/templates/admin/change_form_object_tools.html @@ -2,7 +2,7 @@ {% block object-tools-items %} <li> {% url opts|admin_urlname:'history' original.pk|admin_urlquote as history_url %} - <a href="{% add_preserved_filters history_url %}" class="historylink">{% trans "History" %}</a> + <a href="{% add_preserved_filters history_url %}" class="historylink">{% translate "History" %}</a> </li> -{% if has_absolute_url %}<li><a href="{{ absolute_url }}" class="viewsitelink">{% trans "View on site" %}</a></li>{% endif %} +{% if has_absolute_url %}<li><a href="{{ absolute_url }}" class="viewsitelink">{% translate "View on site" %}</a></li>{% endif %} {% endblock %} diff --git a/django/contrib/admin/templates/admin/change_list.html b/django/contrib/admin/templates/admin/change_list.html index e0dc285924..8b275362af 100644 --- a/django/contrib/admin/templates/admin/change_list.html +++ b/django/contrib/admin/templates/admin/change_list.html @@ -28,7 +28,7 @@ {% if not is_popup %} {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> › <a href="{% url 'admin:app_list' app_label=cl.opts.app_label %}">{{ cl.opts.app_config.verbose_name }}</a> › {{ cl.opts.verbose_name_plural|capfirst }} </div> @@ -48,7 +48,7 @@ {% endblock %} {% if cl.formset and cl.formset.errors %} <p class="errornote"> - {% if cl.formset.total_error_count == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %} + {% if cl.formset.total_error_count == 1 %}{% translate "Please correct the error below." %}{% else %}{% translate "Please correct the errors below." %}{% endif %} </p> {{ cl.formset.non_form_errors }} {% endif %} @@ -59,7 +59,7 @@ {% block filters %} {% if cl.has_filters %} <div id="changelist-filter"> - <h2>{% trans 'Filter' %}</h2> + <h2>{% translate 'Filter' %}</h2> {% for spec in cl.filter_specs %}{% admin_list_filter cl spec %}{% endfor %} </div> {% endif %} diff --git a/django/contrib/admin/templates/admin/change_list_object_tools.html b/django/contrib/admin/templates/admin/change_list_object_tools.html index 5d6d458276..11cc6fa4ba 100644 --- a/django/contrib/admin/templates/admin/change_list_object_tools.html +++ b/django/contrib/admin/templates/admin/change_list_object_tools.html @@ -5,7 +5,7 @@ <li> {% url cl.opts|admin_urlname:'add' as add_url %} <a href="{% add_preserved_filters add_url is_popup to_field %}" class="addlink"> - {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %} + {% blocktranslate with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktranslate %} </a> </li> {% endif %} diff --git a/django/contrib/admin/templates/admin/change_list_results.html b/django/contrib/admin/templates/admin/change_list_results.html index 9b97b5b4f7..a4a2618e04 100644 --- a/django/contrib/admin/templates/admin/change_list_results.html +++ b/django/contrib/admin/templates/admin/change_list_results.html @@ -14,9 +14,9 @@ {% if header.sortable %} {% if header.sort_priority > 0 %} <div class="sortoptions"> - <a class="sortremove" href="{{ header.url_remove }}" title="{% trans "Remove from sorting" %}"></a> - {% if num_sorted_fields > 1 %}<span class="sortpriority" title="{% blocktrans with priority_number=header.sort_priority %}Sorting priority: {{ priority_number }}{% endblocktrans %}">{{ header.sort_priority }}</span>{% endif %} - <a href="{{ header.url_toggle }}" class="toggle {% if header.ascending %}ascending{% else %}descending{% endif %}" title="{% trans "Toggle sorting" %}"></a> + <a class="sortremove" href="{{ header.url_remove }}" title="{% translate "Remove from sorting" %}"></a> + {% if num_sorted_fields > 1 %}<span class="sortpriority" title="{% blocktranslate with priority_number=header.sort_priority %}Sorting priority: {{ priority_number }}{% endblocktranslate %}">{{ header.sort_priority }}</span>{% endif %} + <a href="{{ header.url_toggle }}" class="toggle {% if header.ascending %}ascending{% else %}descending{% endif %}" title="{% translate "Toggle sorting" %}"></a> </div> {% endif %} {% endif %} diff --git a/django/contrib/admin/templates/admin/delete_confirmation.html b/django/contrib/admin/templates/admin/delete_confirmation.html index 4a1c065cb2..bfece58ada 100644 --- a/django/contrib/admin/templates/admin/delete_confirmation.html +++ b/django/contrib/admin/templates/admin/delete_confirmation.html @@ -11,41 +11,41 @@ {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> › <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a> › <a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a> › <a href="{% url opts|admin_urlname:'change' object.pk|admin_urlquote %}">{{ object|truncatewords:"18" }}</a> -› {% trans 'Delete' %} +› {% translate 'Delete' %} </div> {% endblock %} {% block content %} {% if perms_lacking %} - <p>{% blocktrans with escaped_object=object %}Deleting the {{ object_name }} '{{ escaped_object }}' would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:{% endblocktrans %}</p> + <p>{% blocktranslate with escaped_object=object %}Deleting the {{ object_name }} '{{ escaped_object }}' would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:{% endblocktranslate %}</p> <ul> {% for obj in perms_lacking %} <li>{{ obj }}</li> {% endfor %} </ul> {% elif protected %} - <p>{% blocktrans with escaped_object=object %}Deleting the {{ object_name }} '{{ escaped_object }}' would require deleting the following protected related objects:{% endblocktrans %}</p> + <p>{% blocktranslate with escaped_object=object %}Deleting the {{ object_name }} '{{ escaped_object }}' would require deleting the following protected related objects:{% endblocktranslate %}</p> <ul> {% for obj in protected %} <li>{{ obj }}</li> {% endfor %} </ul> {% else %} - <p>{% blocktrans with escaped_object=object %}Are you sure you want to delete the {{ object_name }} "{{ escaped_object }}"? All of the following related items will be deleted:{% endblocktrans %}</p> + <p>{% blocktranslate with escaped_object=object %}Are you sure you want to delete the {{ object_name }} "{{ escaped_object }}"? All of the following related items will be deleted:{% endblocktranslate %}</p> {% include "admin/includes/object_delete_summary.html" %} - <h2>{% trans "Objects" %}</h2> + <h2>{% translate "Objects" %}</h2> <ul>{{ deleted_objects|unordered_list }}</ul> <form method="post">{% csrf_token %} <div> <input type="hidden" name="post" value="yes"> {% if is_popup %}<input type="hidden" name="{{ is_popup_var }}" value="1">{% endif %} {% if to_field %}<input type="hidden" name="{{ to_field_var }}" value="{{ to_field }}">{% endif %} - <input type="submit" value="{% trans 'Yes, I’m sure' %}"> - <a href="#" class="button cancel-link">{% trans "No, take me back" %}</a> + <input type="submit" value="{% translate 'Yes, I’m sure' %}"> + <a href="#" class="button cancel-link">{% translate "No, take me back" %}</a> </div> </form> {% endif %} diff --git a/django/contrib/admin/templates/admin/delete_selected_confirmation.html b/django/contrib/admin/templates/admin/delete_selected_confirmation.html index bab4cd31c2..346d280738 100644 --- a/django/contrib/admin/templates/admin/delete_selected_confirmation.html +++ b/django/contrib/admin/templates/admin/delete_selected_confirmation.html @@ -11,32 +11,32 @@ {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> › <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a> › <a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a> -› {% trans 'Delete multiple objects' %} +› {% translate 'Delete multiple objects' %} </div> {% endblock %} {% block content %} {% if perms_lacking %} - <p>{% blocktrans %}Deleting the selected {{ objects_name }} would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:{% endblocktrans %}</p> + <p>{% blocktranslate %}Deleting the selected {{ objects_name }} would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:{% endblocktranslate %}</p> <ul> {% for obj in perms_lacking %} <li>{{ obj }}</li> {% endfor %} </ul> {% elif protected %} - <p>{% blocktrans %}Deleting the selected {{ objects_name }} would require deleting the following protected related objects:{% endblocktrans %}</p> + <p>{% blocktranslate %}Deleting the selected {{ objects_name }} would require deleting the following protected related objects:{% endblocktranslate %}</p> <ul> {% for obj in protected %} <li>{{ obj }}</li> {% endfor %} </ul> {% else %} - <p>{% blocktrans %}Are you sure you want to delete the selected {{ objects_name }}? All of the following objects and their related items will be deleted:{% endblocktrans %}</p> + <p>{% blocktranslate %}Are you sure you want to delete the selected {{ objects_name }}? All of the following objects and their related items will be deleted:{% endblocktranslate %}</p> {% include "admin/includes/object_delete_summary.html" %} - <h2>{% trans "Objects" %}</h2> + <h2>{% translate "Objects" %}</h2> {% for deletable_object in deletable_objects %} <ul>{{ deletable_object|unordered_list }}</ul> {% endfor %} @@ -47,8 +47,8 @@ {% endfor %} <input type="hidden" name="action" value="delete_selected"> <input type="hidden" name="post" value="yes"> - <input type="submit" value="{% trans 'Yes, I’m sure' %}"> - <a href="#" class="button cancel-link">{% trans "No, take me back" %}</a> + <input type="submit" value="{% translate 'Yes, I’m sure' %}"> + <a href="#" class="button cancel-link">{% translate "No, take me back" %}</a> </div> </form> {% endif %} diff --git a/django/contrib/admin/templates/admin/edit_inline/stacked.html b/django/contrib/admin/templates/admin/edit_inline/stacked.html index d9c27b1578..0fe7a0c0a2 100644 --- a/django/contrib/admin/templates/admin/edit_inline/stacked.html +++ b/django/contrib/admin/templates/admin/edit_inline/stacked.html @@ -9,9 +9,9 @@ {{ inline_admin_formset.formset.non_form_errors }} {% for inline_admin_form in inline_admin_formset %}<div class="inline-related{% if inline_admin_form.original or inline_admin_form.show_url %} has_original{% endif %}{% if forloop.last and inline_admin_formset.has_add_permission %} empty-form last-related{% endif %}" id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}"> - <h3><b>{{ inline_admin_formset.opts.verbose_name|capfirst }}:</b> <span class="inline_label">{% if inline_admin_form.original %}{{ inline_admin_form.original }}{% if inline_admin_form.model_admin.show_change_link and inline_admin_form.model_admin.has_registered_model %} <a href="{% url inline_admin_form.model_admin.opts|admin_urlname:'change' inline_admin_form.original.pk|admin_urlquote %}" class="{% if inline_admin_formset.has_change_permission %}inlinechangelink{% else %}inlineviewlink{% endif %}">{% if inline_admin_formset.has_change_permission %}{% trans "Change" %}{% else %}{% trans "View" %}{% endif %}</a>{% endif %} + <h3><b>{{ inline_admin_formset.opts.verbose_name|capfirst }}:</b> <span class="inline_label">{% if inline_admin_form.original %}{{ inline_admin_form.original }}{% if inline_admin_form.model_admin.show_change_link and inline_admin_form.model_admin.has_registered_model %} <a href="{% url inline_admin_form.model_admin.opts|admin_urlname:'change' inline_admin_form.original.pk|admin_urlquote %}" class="{% if inline_admin_formset.has_change_permission %}inlinechangelink{% else %}inlineviewlink{% endif %}">{% if inline_admin_formset.has_change_permission %}{% translate "Change" %}{% else %}{% translate "View" %}{% endif %}</a>{% endif %} {% else %}#{{ forloop.counter }}{% endif %}</span> - {% if inline_admin_form.show_url %}<a href="{{ inline_admin_form.absolute_url }}">{% trans "View on site" %}</a>{% endif %} + {% if inline_admin_form.show_url %}<a href="{{ inline_admin_form.absolute_url }}">{% translate "View on site" %}</a>{% endif %} {% if inline_admin_formset.formset.can_delete and inline_admin_formset.has_delete_permission and inline_admin_form.original %}<span class="delete">{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}</span>{% endif %} </h3> {% if inline_admin_form.form.non_field_errors %}{{ inline_admin_form.form.non_field_errors }}{% endif %} diff --git a/django/contrib/admin/templates/admin/edit_inline/tabular.html b/django/contrib/admin/templates/admin/edit_inline/tabular.html index 261592af6e..94f97d94b6 100644 --- a/django/contrib/admin/templates/admin/edit_inline/tabular.html +++ b/django/contrib/admin/templates/admin/edit_inline/tabular.html @@ -17,7 +17,7 @@ </th> {% endif %} {% endfor %} - {% if inline_admin_formset.formset.can_delete and inline_admin_formset.has_delete_permission %}<th>{% trans "Delete?" %}</th>{% endif %} + {% if inline_admin_formset.formset.can_delete and inline_admin_formset.has_delete_permission %}<th>{% translate "Delete?" %}</th>{% endif %} </tr></thead> <tbody> @@ -31,9 +31,9 @@ {% if inline_admin_form.original or inline_admin_form.show_url %}<p> {% if inline_admin_form.original %} {{ inline_admin_form.original }} - {% if inline_admin_form.model_admin.show_change_link and inline_admin_form.model_admin.has_registered_model %}<a href="{% url inline_admin_form.model_admin.opts|admin_urlname:'change' inline_admin_form.original.pk|admin_urlquote %}" class="{% if inline_admin_formset.has_change_permission %}inlinechangelink{% else %}inlineviewlink{% endif %}">{% if inline_admin_formset.has_change_permission %}{% trans "Change" %}{% else %}{% trans "View" %}{% endif %}</a>{% endif %} + {% if inline_admin_form.model_admin.show_change_link and inline_admin_form.model_admin.has_registered_model %}<a href="{% url inline_admin_form.model_admin.opts|admin_urlname:'change' inline_admin_form.original.pk|admin_urlquote %}" class="{% if inline_admin_formset.has_change_permission %}inlinechangelink{% else %}inlineviewlink{% endif %}">{% if inline_admin_formset.has_change_permission %}{% translate "Change" %}{% else %}{% translate "View" %}{% endif %}</a>{% endif %} {% endif %} - {% if inline_admin_form.show_url %}<a href="{{ inline_admin_form.absolute_url }}">{% trans "View on site" %}</a>{% endif %} + {% if inline_admin_form.show_url %}<a href="{{ inline_admin_form.absolute_url }}">{% translate "View on site" %}</a>{% endif %} </p>{% endif %} {% if inline_admin_form.needs_explicit_pk_field %}{{ inline_admin_form.pk_field.field }}{% endif %} {% if inline_admin_form.fk_field %}{{ inline_admin_form.fk_field.field }}{% endif %} diff --git a/django/contrib/admin/templates/admin/filter.html b/django/contrib/admin/templates/admin/filter.html index cd88652a62..35dc553bd8 100644 --- a/django/contrib/admin/templates/admin/filter.html +++ b/django/contrib/admin/templates/admin/filter.html @@ -1,5 +1,5 @@ {% load i18n %} -<h3>{% blocktrans with filter_title=title %} By {{ filter_title }} {% endblocktrans %}</h3> +<h3>{% blocktranslate with filter_title=title %} By {{ filter_title }} {% endblocktranslate %}</h3> <ul> {% for choice in choices %} <li{% if choice.selected %} class="selected"{% endif %}> diff --git a/django/contrib/admin/templates/admin/includes/object_delete_summary.html b/django/contrib/admin/templates/admin/includes/object_delete_summary.html index 6a8bf6542a..9ad97db2fc 100644 --- a/django/contrib/admin/templates/admin/includes/object_delete_summary.html +++ b/django/contrib/admin/templates/admin/includes/object_delete_summary.html @@ -1,5 +1,5 @@ {% load i18n %} -<h2>{% trans "Summary" %}</h2> +<h2>{% translate "Summary" %}</h2> <ul> {% for model_name, object_count in model_count %} <li>{{ model_name|capfirst }}: {{ object_count }}</li> diff --git a/django/contrib/admin/templates/admin/index.html b/django/contrib/admin/templates/admin/index.html index 746cdcdf60..221ddf2a0a 100644 --- a/django/contrib/admin/templates/admin/index.html +++ b/django/contrib/admin/templates/admin/index.html @@ -17,7 +17,7 @@ <div class="app-{{ app.app_label }} module"> <table> <caption> - <a href="{{ app.app_url }}" class="section" title="{% blocktrans with name=app.name %}Models in the {{ name }} application{% endblocktrans %}">{{ app.name }}</a> + <a href="{{ app.app_url }}" class="section" title="{% blocktranslate with name=app.name %}Models in the {{ name }} application{% endblocktranslate %}">{{ app.name }}</a> </caption> {% for model in app.models %} <tr class="model-{{ model.object_name|lower }}"> @@ -28,16 +28,16 @@ {% endif %} {% if model.add_url %} - <td><a href="{{ model.add_url }}" class="addlink">{% trans 'Add' %}</a></td> + <td><a href="{{ model.add_url }}" class="addlink">{% translate 'Add' %}</a></td> {% else %} <td> </td> {% endif %} {% if model.admin_url %} {% if model.view_only %} - <td><a href="{{ model.admin_url }}" class="viewlink">{% trans 'View' %}</a></td> + <td><a href="{{ model.admin_url }}" class="viewlink">{% translate 'View' %}</a></td> {% else %} - <td><a href="{{ model.admin_url }}" class="changelink">{% trans 'Change' %}</a></td> + <td><a href="{{ model.admin_url }}" class="changelink">{% translate 'Change' %}</a></td> {% endif %} {% else %} <td> </td> @@ -48,7 +48,7 @@ </div> {% endfor %} {% else %} - <p>{% trans 'You don’t have permission to view or edit anything.' %}</p> + <p>{% translate 'You don’t have permission to view or edit anything.' %}</p> {% endif %} </div> {% endblock %} @@ -56,12 +56,12 @@ {% block sidebar %} <div id="content-related"> <div class="module" id="recent-actions-module"> - <h2>{% trans 'Recent actions' %}</h2> - <h3>{% trans 'My actions' %}</h3> + <h2>{% translate 'Recent actions' %}</h2> + <h3>{% translate 'My actions' %}</h3> {% load log %} {% get_admin_log 10 as admin_log for_user user %} {% if not admin_log %} - <p>{% trans 'None available' %}</p> + <p>{% translate 'None available' %}</p> {% else %} <ul class="actionlist"> {% for entry in admin_log %} @@ -75,7 +75,7 @@ {% if entry.content_type %} <span class="mini quiet">{% filter capfirst %}{{ entry.content_type.name }}{% endfilter %}</span> {% else %} - <span class="mini quiet">{% trans 'Unknown content' %}</span> + <span class="mini quiet">{% translate 'Unknown content' %}</span> {% endif %} </li> {% endfor %} diff --git a/django/contrib/admin/templates/admin/invalid_setup.html b/django/contrib/admin/templates/admin/invalid_setup.html index c86ae31509..1ef7c71434 100644 --- a/django/contrib/admin/templates/admin/invalid_setup.html +++ b/django/contrib/admin/templates/admin/invalid_setup.html @@ -3,11 +3,11 @@ {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> › {{ title }} </div> {% endblock %} {% block content %} -<p>{% trans 'Something’s wrong with your database installation. Make sure the appropriate database tables have been created, and make sure the database is readable by the appropriate user.' %}</p> +<p>{% translate 'Something’s wrong with your database installation. Make sure the appropriate database tables have been created, and make sure the database is readable by the appropriate user.' %}</p> {% endblock %} diff --git a/django/contrib/admin/templates/admin/login.html b/django/contrib/admin/templates/admin/login.html index 396be276f9..bbcfe4d49a 100644 --- a/django/contrib/admin/templates/admin/login.html +++ b/django/contrib/admin/templates/admin/login.html @@ -18,7 +18,7 @@ {% block content %} {% if form.errors and not form.non_field_errors %} <p class="errornote"> -{% if form.errors.items|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %} +{% if form.errors.items|length == 1 %}{% translate "Please correct the error below." %}{% else %}{% translate "Please correct the errors below." %}{% endif %} </p> {% endif %} @@ -34,10 +34,10 @@ {% if user.is_authenticated %} <p class="errornote"> -{% blocktrans trimmed %} +{% blocktranslate trimmed %} You are authenticated as {{ username }}, but are not authorized to access this page. Would you like to login to a different account? -{% endblocktrans %} +{% endblocktranslate %} </p> {% endif %} @@ -54,11 +54,11 @@ {% url 'admin_password_reset' as password_reset_url %} {% if password_reset_url %} <div class="password-reset-link"> - <a href="{{ password_reset_url }}">{% trans 'Forgotten your password or username?' %}</a> + <a href="{{ password_reset_url }}">{% translate 'Forgotten your password or username?' %}</a> </div> {% endif %} <div class="submit-row"> - <label> </label><input type="submit" value="{% trans 'Log in' %}"> + <label> </label><input type="submit" value="{% translate 'Log in' %}"> </div> </form> diff --git a/django/contrib/admin/templates/admin/object_history.html b/django/contrib/admin/templates/admin/object_history.html index 52b3c77051..3015f36c4a 100644 --- a/django/contrib/admin/templates/admin/object_history.html +++ b/django/contrib/admin/templates/admin/object_history.html @@ -3,11 +3,11 @@ {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> › <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a> › <a href="{% url opts|admin_urlname:'changelist' %}">{{ module_name }}</a> › <a href="{% url opts|admin_urlname:'change' object.pk|admin_urlquote %}">{{ object|truncatewords:"18" }}</a> -› {% trans 'History' %} +› {% translate 'History' %} </div> {% endblock %} @@ -19,9 +19,9 @@ <table id="change-history"> <thead> <tr> - <th scope="col">{% trans 'Date/time' %}</th> - <th scope="col">{% trans 'User' %}</th> - <th scope="col">{% trans 'Action' %}</th> + <th scope="col">{% translate 'Date/time' %}</th> + <th scope="col">{% translate 'User' %}</th> + <th scope="col">{% translate 'Action' %}</th> </tr> </thead> <tbody> @@ -35,7 +35,7 @@ </tbody> </table> {% else %} - <p>{% trans 'This object doesn’t have a change history. It probably wasn’t added via this admin site.' %}</p> + <p>{% translate 'This object doesn’t have a change history. It probably wasn’t added via this admin site.' %}</p> {% endif %} </div> </div> diff --git a/django/contrib/admin/templates/admin/pagination.html b/django/contrib/admin/templates/admin/pagination.html index bef843a444..d0ae8ba067 100644 --- a/django/contrib/admin/templates/admin/pagination.html +++ b/django/contrib/admin/templates/admin/pagination.html @@ -7,6 +7,6 @@ {% endfor %} {% endif %} {{ cl.result_count }} {% if cl.result_count == 1 %}{{ cl.opts.verbose_name }}{% else %}{{ cl.opts.verbose_name_plural }}{% endif %} -{% if show_all_url %} <a href="{{ show_all_url }}" class="showall">{% trans 'Show all' %}</a>{% endif %} -{% if cl.formset and cl.result_count %}<input type="submit" name="_save" class="default" value="{% trans 'Save' %}">{% endif %} +{% if show_all_url %} <a href="{{ show_all_url }}" class="showall">{% translate 'Show all' %}</a>{% endif %} +{% if cl.formset and cl.result_count %}<input type="submit" name="_save" class="default" value="{% translate 'Save' %}">{% endif %} </p> diff --git a/django/contrib/admin/templates/admin/popup_response.html b/django/contrib/admin/templates/admin/popup_response.html index 509a81a7c2..57a1ae3661 100644 --- a/django/contrib/admin/templates/admin/popup_response.html +++ b/django/contrib/admin/templates/admin/popup_response.html @@ -1,6 +1,6 @@ {% load i18n static %}<!DOCTYPE html> <html> - <head><title>{% trans 'Popup closing…' %}</title></head> + <head><title>{% translate 'Popup closing…' %}</title></head> <body> <script id="django-admin-popup-response-constants" src="{% static "admin/js/popup_response.js" %}" diff --git a/django/contrib/admin/templates/admin/search_form.html b/django/contrib/admin/templates/admin/search_form.html index 3bb5cba52c..3ec37f2ef7 100644 --- a/django/contrib/admin/templates/admin/search_form.html +++ b/django/contrib/admin/templates/admin/search_form.html @@ -4,9 +4,9 @@ <div><!-- DIV needed for valid HTML --> <label for="searchbar"><img src="{% static "admin/img/search.svg" %}" alt="Search"></label> <input type="text" size="40" name="{{ search_var }}" value="{{ cl.query }}" id="searchbar" autofocus> -<input type="submit" value="{% trans 'Search' %}"> +<input type="submit" value="{% translate 'Search' %}"> {% if show_result_count %} - <span class="small quiet">{% blocktrans count counter=cl.result_count %}{{ counter }} result{% plural %}{{ counter }} results{% endblocktrans %} (<a href="?{% if cl.is_popup %}_popup=1{% endif %}">{% if cl.show_full_result_count %}{% blocktrans with full_result_count=cl.full_result_count %}{{ full_result_count }} total{% endblocktrans %}{% else %}{% trans "Show all" %}{% endif %}</a>)</span> + <span class="small quiet">{% blocktranslate count counter=cl.result_count %}{{ counter }} result{% plural %}{{ counter }} results{% endblocktranslate %} (<a href="?{% if cl.is_popup %}_popup=1{% endif %}">{% if cl.show_full_result_count %}{% blocktranslate with full_result_count=cl.full_result_count %}{{ full_result_count }} total{% endblocktranslate %}{% else %}{% translate "Show all" %}{% endif %}</a>)</span> {% endif %} {% for pair in cl.params.items %} {% if pair.0 != search_var %}<input type="hidden" name="{{ pair.0 }}" value="{{ pair.1 }}">{% endif %} diff --git a/django/contrib/admin/templates/admin/submit_line.html b/django/contrib/admin/templates/admin/submit_line.html index bb283fe9e0..f401f0d8aa 100644 --- a/django/contrib/admin/templates/admin/submit_line.html +++ b/django/contrib/admin/templates/admin/submit_line.html @@ -1,14 +1,14 @@ {% load i18n admin_urls %} <div class="submit-row"> {% block submit-row %} -{% if show_save %}<input type="submit" value="{% trans 'Save' %}" class="default" name="_save">{% endif %} +{% if show_save %}<input type="submit" value="{% translate 'Save' %}" class="default" name="_save">{% endif %} {% if show_delete_link and original %} {% url opts|admin_urlname:'delete' original.pk|admin_urlquote as delete_url %} - <p class="deletelink-box"><a href="{% add_preserved_filters delete_url %}" class="deletelink">{% trans "Delete" %}</a></p> + <p class="deletelink-box"><a href="{% add_preserved_filters delete_url %}" class="deletelink">{% translate "Delete" %}</a></p> {% endif %} -{% if show_save_as_new %}<input type="submit" value="{% trans 'Save as new' %}" name="_saveasnew">{% endif %} -{% if show_save_and_add_another %}<input type="submit" value="{% trans 'Save and add another' %}" name="_addanother">{% endif %} -{% if show_save_and_continue %}<input type="submit" value="{% if can_change %}{% trans 'Save and continue editing' %}{% else %}{% trans 'Save and view' %}{% endif %}" name="_continue">{% endif %} -{% if show_close %}<a href="{% url opts|admin_urlname:'changelist' %}" class="closelink">{% trans 'Close' %}</a>{% endif %} +{% if show_save_as_new %}<input type="submit" value="{% translate 'Save as new' %}" name="_saveasnew">{% endif %} +{% if show_save_and_add_another %}<input type="submit" value="{% translate 'Save and add another' %}" name="_addanother">{% endif %} +{% if show_save_and_continue %}<input type="submit" value="{% if can_change %}{% translate 'Save and continue editing' %}{% else %}{% translate 'Save and view' %}{% endif %}" name="_continue">{% endif %} +{% if show_close %}<a href="{% url opts|admin_urlname:'changelist' %}" class="closelink">{% translate 'Close' %}</a>{% endif %} {% endblock %} </div> diff --git a/django/contrib/admin/templates/admin/widgets/related_widget_wrapper.html b/django/contrib/admin/templates/admin/widgets/related_widget_wrapper.html index 7cdcb334c9..a97bec16e3 100644 --- a/django/contrib/admin/templates/admin/widgets/related_widget_wrapper.html +++ b/django/contrib/admin/templates/admin/widgets/related_widget_wrapper.html @@ -7,22 +7,22 @@ {% if can_change_related %} <a class="related-widget-wrapper-link change-related" id="change_id_{{ name }}" data-href-template="{{ change_related_template_url }}?{{ url_params }}" - title="{% blocktrans %}Change selected {{ model }}{% endblocktrans %}"> - <img src="{% static 'admin/img/icon-changelink.svg' %}" alt="{% trans 'Change' %}"> + title="{% blocktranslate %}Change selected {{ model }}{% endblocktranslate %}"> + <img src="{% static 'admin/img/icon-changelink.svg' %}" alt="{% translate 'Change' %}"> </a> {% endif %} {% if can_add_related %} <a class="related-widget-wrapper-link add-related" id="add_id_{{ name }}" href="{{ add_related_url }}?{{ url_params }}" - title="{% blocktrans %}Add another {{ model }}{% endblocktrans %}"> - <img src="{% static 'admin/img/icon-addlink.svg' %}" alt="{% trans 'Add' %}"> + title="{% blocktranslate %}Add another {{ model }}{% endblocktranslate %}"> + <img src="{% static 'admin/img/icon-addlink.svg' %}" alt="{% translate 'Add' %}"> </a> {% endif %} {% if can_delete_related %} <a class="related-widget-wrapper-link delete-related" id="delete_id_{{ name }}" data-href-template="{{ delete_related_template_url }}?{{ url_params }}" - title="{% blocktrans %}Delete selected {{ model }}{% endblocktrans %}"> - <img src="{% static 'admin/img/icon-deletelink.svg' %}" alt="{% trans 'Delete' %}"> + title="{% blocktranslate %}Delete selected {{ model }}{% endblocktranslate %}"> + <img src="{% static 'admin/img/icon-deletelink.svg' %}" alt="{% translate 'Delete' %}"> </a> {% endif %} {% endif %} diff --git a/django/contrib/admin/templates/registration/logged_out.html b/django/contrib/admin/templates/registration/logged_out.html index 6a18186f7f..90bb8ee668 100644 --- a/django/contrib/admin/templates/registration/logged_out.html +++ b/django/contrib/admin/templates/registration/logged_out.html @@ -1,12 +1,12 @@ {% extends "admin/base_site.html" %} {% load i18n %} -{% block breadcrumbs %}<div class="breadcrumbs"><a href="{% url 'admin:index' %}">{% trans 'Home' %}</a></div>{% endblock %} +{% block breadcrumbs %}<div class="breadcrumbs"><a href="{% url 'admin:index' %}">{% translate 'Home' %}</a></div>{% endblock %} {% block content %} -<p>{% trans "Thanks for spending some quality time with the Web site today." %}</p> +<p>{% translate "Thanks for spending some quality time with the Web site today." %}</p> -<p><a href="{% url 'admin:index' %}">{% trans 'Log in again' %}</a></p> +<p><a href="{% url 'admin:index' %}">{% translate 'Log in again' %}</a></p> {% endblock %} diff --git a/django/contrib/admin/templates/registration/password_change_done.html b/django/contrib/admin/templates/registration/password_change_done.html index 3e557ebef3..9cc85f8361 100644 --- a/django/contrib/admin/templates/registration/password_change_done.html +++ b/django/contrib/admin/templates/registration/password_change_done.html @@ -1,15 +1,15 @@ {% extends "admin/base_site.html" %} {% load i18n %} -{% block userlinks %}{% url 'django-admindocs-docroot' as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> / {% endif %}{% trans 'Change password' %} / <a href="{% url 'admin:logout' %}">{% trans 'Log out' %}</a>{% endblock %} +{% block userlinks %}{% url 'django-admindocs-docroot' as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% translate 'Documentation' %}</a> / {% endif %}{% translate 'Change password' %} / <a href="{% url 'admin:logout' %}">{% translate 'Log out' %}</a>{% endblock %} {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> -› {% trans 'Password change' %} +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> +› {% translate 'Password change' %} </div> {% endblock %} {% block title %}{{ title }}{% endblock %} {% block content_title %}<h1>{{ title }}</h1>{% endblock %} {% block content %} -<p>{% trans 'Your password was changed.' %}</p> +<p>{% translate 'Your password was changed.' %}</p> {% endblock %} diff --git a/django/contrib/admin/templates/registration/password_change_form.html b/django/contrib/admin/templates/registration/password_change_form.html index 2cc4dbec06..d3a9bf305d 100644 --- a/django/contrib/admin/templates/registration/password_change_form.html +++ b/django/contrib/admin/templates/registration/password_change_form.html @@ -1,11 +1,11 @@ {% extends "admin/base_site.html" %} {% load i18n static %} {% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}">{% endblock %} -{% block userlinks %}{% url 'django-admindocs-docroot' as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> / {% endif %} {% trans 'Change password' %} / <a href="{% url 'admin:logout' %}">{% trans 'Log out' %}</a>{% endblock %} +{% block userlinks %}{% url 'django-admindocs-docroot' as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% translate 'Documentation' %}</a> / {% endif %} {% translate 'Change password' %} / <a href="{% url 'admin:logout' %}">{% translate 'Log out' %}</a>{% endblock %} {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> -› {% trans 'Password change' %} +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> +› {% translate 'Password change' %} </div> {% endblock %} @@ -18,12 +18,12 @@ <div> {% if form.errors %} <p class="errornote"> - {% if form.errors.items|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %} + {% if form.errors.items|length == 1 %}{% translate "Please correct the error below." %}{% else %}{% translate "Please correct the errors below." %}{% endif %} </p> {% endif %} -<p>{% trans 'Please enter your old password, for security’s sake, and then enter your new password twice so we can verify you typed it in correctly.' %}</p> +<p>{% translate 'Please enter your old password, for security’s sake, and then enter your new password twice so we can verify you typed it in correctly.' %}</p> <fieldset class="module aligned wide"> @@ -51,7 +51,7 @@ </fieldset> <div class="submit-row"> - <input type="submit" value="{% trans 'Change my password' %}" class="default"> + <input type="submit" value="{% translate 'Change my password' %}" class="default"> </div> </div> diff --git a/django/contrib/admin/templates/registration/password_reset_complete.html b/django/contrib/admin/templates/registration/password_reset_complete.html index 19f87a5b76..396f339841 100644 --- a/django/contrib/admin/templates/registration/password_reset_complete.html +++ b/django/contrib/admin/templates/registration/password_reset_complete.html @@ -3,8 +3,8 @@ {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> -› {% trans 'Password reset' %} +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> +› {% translate 'Password reset' %} </div> {% endblock %} @@ -13,8 +13,8 @@ {% block content %} -<p>{% trans "Your password has been set. You may go ahead and log in now." %}</p> +<p>{% translate "Your password has been set. You may go ahead and log in now." %}</p> -<p><a href="{{ login_url }}">{% trans 'Log in' %}</a></p> +<p><a href="{{ login_url }}">{% translate 'Log in' %}</a></p> {% endblock %} diff --git a/django/contrib/admin/templates/registration/password_reset_confirm.html b/django/contrib/admin/templates/registration/password_reset_confirm.html index 8666fa903c..20ef252b95 100644 --- a/django/contrib/admin/templates/registration/password_reset_confirm.html +++ b/django/contrib/admin/templates/registration/password_reset_confirm.html @@ -4,8 +4,8 @@ {% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}">{% endblock %} {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> -› {% trans 'Password reset confirmation' %} +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> +› {% translate 'Password reset confirmation' %} </div> {% endblock %} @@ -15,27 +15,27 @@ {% if validlink %} -<p>{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}</p> +<p>{% translate "Please enter your new password twice so we can verify you typed it in correctly." %}</p> <form method="post">{% csrf_token %} <fieldset class="module aligned"> <div class="form-row field-password1"> {{ form.new_password1.errors }} - <label for="id_new_password1">{% trans 'New password:' %}</label> + <label for="id_new_password1">{% translate 'New password:' %}</label> {{ form.new_password1 }} </div> <div class="form-row field-password2"> {{ form.new_password2.errors }} - <label for="id_new_password2">{% trans 'Confirm password:' %}</label> + <label for="id_new_password2">{% translate 'Confirm password:' %}</label> {{ form.new_password2 }} </div> - <input type="submit" value="{% trans 'Change my password' %}"> + <input type="submit" value="{% translate 'Change my password' %}"> </fieldset> </form> {% else %} -<p>{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}</p> +<p>{% translate "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}</p> {% endif %} diff --git a/django/contrib/admin/templates/registration/password_reset_done.html b/django/contrib/admin/templates/registration/password_reset_done.html index 99aaf7a75a..1f6e83aaaf 100644 --- a/django/contrib/admin/templates/registration/password_reset_done.html +++ b/django/contrib/admin/templates/registration/password_reset_done.html @@ -3,8 +3,8 @@ {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> -› {% trans 'Password reset' %} +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> +› {% translate 'Password reset' %} </div> {% endblock %} @@ -12,8 +12,8 @@ {% block content_title %}<h1>{{ title }}</h1>{% endblock %} {% block content %} -<p>{% trans 'We’ve emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly.' %}</p> +<p>{% translate 'We’ve emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly.' %}</p> -<p>{% trans 'If you don’t receive an email, please make sure you’ve entered the address you registered with, and check your spam folder.' %}</p> +<p>{% translate 'If you don’t receive an email, please make sure you’ve entered the address you registered with, and check your spam folder.' %}</p> {% endblock %} diff --git a/django/contrib/admin/templates/registration/password_reset_email.html b/django/contrib/admin/templates/registration/password_reset_email.html index 9e1e94a781..64822091d1 100644 --- a/django/contrib/admin/templates/registration/password_reset_email.html +++ b/django/contrib/admin/templates/registration/password_reset_email.html @@ -1,14 +1,14 @@ {% load i18n %}{% autoescape off %} -{% blocktrans %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %} +{% blocktranslate %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktranslate %} -{% trans "Please go to the following page and choose a new password:" %} +{% translate "Please go to the following page and choose a new password:" %} {% block reset_link %} {{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %} {% endblock %} -{% trans 'Your username, in case you’ve forgotten:' %} {{ user.get_username }} +{% translate 'Your username, in case you’ve forgotten:' %} {{ user.get_username }} -{% trans "Thanks for using our site!" %} +{% translate "Thanks for using our site!" %} -{% blocktrans %}The {{ site_name }} team{% endblocktrans %} +{% blocktranslate %}The {{ site_name }} team{% endblocktranslate %} {% endautoescape %} diff --git a/django/contrib/admin/templates/registration/password_reset_form.html b/django/contrib/admin/templates/registration/password_reset_form.html index dccf62f367..d5493d9d61 100644 --- a/django/contrib/admin/templates/registration/password_reset_form.html +++ b/django/contrib/admin/templates/registration/password_reset_form.html @@ -4,8 +4,8 @@ {% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}">{% endblock %} {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> -› {% trans 'Password reset' %} +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> +› {% translate 'Password reset' %} </div> {% endblock %} @@ -13,16 +13,16 @@ {% block content_title %}<h1>{{ title }}</h1>{% endblock %} {% block content %} -<p>{% trans 'Forgotten your password? Enter your email address below, and we’ll email instructions for setting a new one.' %}</p> +<p>{% translate 'Forgotten your password? Enter your email address below, and we’ll email instructions for setting a new one.' %}</p> <form method="post">{% csrf_token %} <fieldset class="module aligned"> <div class="form-row field-email"> {{ form.email.errors }} - <label for="id_email">{% trans 'Email address:' %}</label> + <label for="id_email">{% translate 'Email address:' %}</label> {{ form.email }} </div> - <input type="submit" value="{% trans 'Reset my password' %}"> + <input type="submit" value="{% translate 'Reset my password' %}"> </fieldset> </form> diff --git a/django/contrib/admindocs/templates/admin_doc/bookmarklets.html b/django/contrib/admindocs/templates/admin_doc/bookmarklets.html index de57e06945..adff7ed920 100644 --- a/django/contrib/admindocs/templates/admin_doc/bookmarklets.html +++ b/django/contrib/admindocs/templates/admin_doc/bookmarklets.html @@ -3,24 +3,24 @@ {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> -› <a href="{% url 'django-admindocs-docroot' %}">{% trans 'Documentation' %}</a> -› {% trans 'Bookmarklets' %} +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> +› <a href="{% url 'django-admindocs-docroot' %}">{% translate 'Documentation' %}</a> +› {% translate 'Bookmarklets' %} </div> {% endblock %} -{% block title %}{% trans "Documentation bookmarklets" %}{% endblock %} +{% block title %}{% translate "Documentation bookmarklets" %}{% endblock %} {% block content %} -<p class="help">{% blocktrans trimmed %} +<p class="help">{% blocktranslate trimmed %} To install bookmarklets, drag the link to your bookmarks toolbar, or right-click the link and add it to your bookmarks. Now you can select the bookmarklet from any page in the site. -{% endblocktrans %}</p> +{% endblocktranslate %}</p> <div id="content-main"> - <h3><a href="javascript:(function(){if(typeof XMLHttpRequest!='undefined'){x=new XMLHttpRequest()}else{return;}x.open('HEAD',location.href,false);x.send(null);try{view=x.getResponseHeader('x-view');}catch(e){alert('No view found for this page');return;}if(view=='undefined'){alert('No view found for this page');}document.location='{% url 'django-admindocs-views-index' %}'+view+'/';})()">{% trans "Documentation for this page" %}</a></h3> - <p>{% trans "Jumps you from any page to the documentation for the view that generates that page." %}</p> + <h3><a href="javascript:(function(){if(typeof XMLHttpRequest!='undefined'){x=new XMLHttpRequest()}else{return;}x.open('HEAD',location.href,false);x.send(null);try{view=x.getResponseHeader('x-view');}catch(e){alert('No view found for this page');return;}if(view=='undefined'){alert('No view found for this page');}document.location='{% url 'django-admindocs-views-index' %}'+view+'/';})()">{% translate "Documentation for this page" %}</a></h3> + <p>{% translate "Jumps you from any page to the documentation for the view that generates that page." %}</p> </div> {% endblock %} diff --git a/django/contrib/admindocs/templates/admin_doc/index.html b/django/contrib/admindocs/templates/admin_doc/index.html index aa86a4b549..1be7873632 100644 --- a/django/contrib/admindocs/templates/admin_doc/index.html +++ b/django/contrib/admindocs/templates/admin_doc/index.html @@ -3,31 +3,31 @@ {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> -› {% trans 'Documentation' %} +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> +› {% translate 'Documentation' %} </div> {% endblock %} -{% block title %}{% trans 'Documentation' %}{% endblock %} +{% block title %}{% translate 'Documentation' %}{% endblock %} {% block content %} -<h1>{% trans 'Documentation' %}</h1> +<h1>{% translate 'Documentation' %}</h1> <div id="content-main"> - <h3><a href="tags/">{% trans 'Tags' %}</a></h3> - <p>{% trans 'List of all the template tags and their functions.' %}</p> + <h3><a href="tags/">{% translate 'Tags' %}</a></h3> + <p>{% translate 'List of all the template tags and their functions.' %}</p> - <h3><a href="filters/">{% trans 'Filters' %}</a></h3> - <p>{% trans 'Filters are actions which can be applied to variables in a template to alter the output.' %}</p> + <h3><a href="filters/">{% translate 'Filters' %}</a></h3> + <p>{% translate 'Filters are actions which can be applied to variables in a template to alter the output.' %}</p> - <h3><a href="models/">{% trans 'Models' %}</a></h3> - <p>{% trans 'Models are descriptions of all the objects in the system and their associated fields. Each model has a list of fields which can be accessed as template variables' %}.</p> + <h3><a href="models/">{% translate 'Models' %}</a></h3> + <p>{% translate 'Models are descriptions of all the objects in the system and their associated fields. Each model has a list of fields which can be accessed as template variables' %}.</p> - <h3><a href="views/">{% trans 'Views' %}</a></h3> - <p>{% trans 'Each page on the public site is generated by a view. The view defines which template is used to generate the page and which objects are available to that template.' %}</p> + <h3><a href="views/">{% translate 'Views' %}</a></h3> + <p>{% translate 'Each page on the public site is generated by a view. The view defines which template is used to generate the page and which objects are available to that template.' %}</p> - <h3><a href="bookmarklets/">{% trans 'Bookmarklets' %}</a></h3> - <p>{% trans 'Tools for your browser to quickly access admin functionality.' %}</p> + <h3><a href="bookmarklets/">{% translate 'Bookmarklets' %}</a></h3> + <p>{% translate 'Tools for your browser to quickly access admin functionality.' %}</p> </div> {% endblock %} diff --git a/django/contrib/admindocs/templates/admin_doc/missing_docutils.html b/django/contrib/admindocs/templates/admin_doc/missing_docutils.html index 123668f732..984aea6278 100644 --- a/django/contrib/admindocs/templates/admin_doc/missing_docutils.html +++ b/django/contrib/admindocs/templates/admin_doc/missing_docutils.html @@ -3,20 +3,20 @@ {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> -› {% trans 'Documentation' %} +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> +› {% translate 'Documentation' %} </div> {% endblock %} -{% block title %}{% trans 'Please install docutils' %}{% endblock %} +{% block title %}{% translate 'Please install docutils' %}{% endblock %} {% block content %} -<h1>{% trans 'Documentation' %}</h1> +<h1>{% translate 'Documentation' %}</h1> <div id="content-main"> - <h3>{% blocktrans with "http://docutils.sf.net/" as link %}The admin documentation system requires Python's <a href="{{ link }}">docutils</a> library.{% endblocktrans %}</h3> + <h3>{% blocktranslate with "http://docutils.sf.net/" as link %}The admin documentation system requires Python's <a href="{{ link }}">docutils</a> library.{% endblocktranslate %}</h3> - <p>{% blocktrans with "http://docutils.sf.net/" as link %}Please ask your administrators to install <a href="{{ link }}">docutils</a>.{% endblocktrans %}</p> + <p>{% blocktranslate with "http://docutils.sf.net/" as link %}Please ask your administrators to install <a href="{{ link }}">docutils</a>.{% endblocktranslate %}</p> </div> {% endblock %} diff --git a/django/contrib/admindocs/templates/admin_doc/model_detail.html b/django/contrib/admindocs/templates/admin_doc/model_detail.html index 9044099f70..8bde21e3ef 100644 --- a/django/contrib/admindocs/templates/admin_doc/model_detail.html +++ b/django/contrib/admindocs/templates/admin_doc/model_detail.html @@ -11,14 +11,14 @@ {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> -› <a href="{% url 'django-admindocs-docroot' %}">{% trans 'Documentation' %}</a> -› <a href="{% url 'django-admindocs-models-index' %}">{% trans 'Models' %}</a> +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> +› <a href="{% url 'django-admindocs-docroot' %}">{% translate 'Documentation' %}</a> +› <a href="{% url 'django-admindocs-models-index' %}">{% translate 'Models' %}</a> › {{ name }} </div> {% endblock %} -{% block title %}{% blocktrans %}Model: {{ name }}{% endblocktrans %}{% endblock %} +{% block title %}{% blocktranslate %}Model: {{ name }}{% endblocktranslate %}{% endblock %} {% block content %} <div id="content-main"> @@ -27,14 +27,14 @@ {{ description }} -<h3>{% trans 'Fields' %}</h3> +<h3>{% translate 'Fields' %}</h3> <div class="module"> <table class="model"> <thead> <tr> - <th>{% trans 'Field' %}</th> - <th>{% trans 'Type' %}</th> - <th>{% trans 'Description' %}</th> + <th>{% translate 'Field' %}</th> + <th>{% translate 'Type' %}</th> + <th>{% translate 'Description' %}</th> </tr> </thead> <tbody> @@ -50,14 +50,14 @@ </div> {% if methods %} -<h3>{% trans 'Methods with arguments' %}</h3> +<h3>{% translate 'Methods with arguments' %}</h3> <div class="module"> <table class="model"> <thead> <tr> - <th>{% trans 'Method' %}</th> - <th>{% trans 'Arguments' %}</th> - <th>{% trans 'Description' %}</th> + <th>{% translate 'Method' %}</th> + <th>{% translate 'Arguments' %}</th> + <th>{% translate 'Description' %}</th> </tr> </thead> <tbody> @@ -73,6 +73,6 @@ </div> {% endif %} -<p class="small"><a href="{% url 'django-admindocs-models-index' %}">‹ {% trans 'Back to Model documentation' %}</a></p> +<p class="small"><a href="{% url 'django-admindocs-models-index' %}">‹ {% translate 'Back to Model documentation' %}</a></p> </div> {% endblock %} diff --git a/django/contrib/admindocs/templates/admin_doc/model_index.html b/django/contrib/admindocs/templates/admin_doc/model_index.html index 4b897c318b..2342be4ba6 100644 --- a/django/contrib/admindocs/templates/admin_doc/model_index.html +++ b/django/contrib/admindocs/templates/admin_doc/model_index.html @@ -5,17 +5,17 @@ {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> -› <a href="{% url 'django-admindocs-docroot' %}">{% trans 'Documentation' %}</a> -› {% trans 'Models' %} +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> +› <a href="{% url 'django-admindocs-docroot' %}">{% translate 'Documentation' %}</a> +› {% translate 'Models' %} </div> {% endblock %} -{% block title %}{% trans 'Models' %}{% endblock %} +{% block title %}{% translate 'Models' %}{% endblock %} {% block content %} -<h1>{% trans 'Model documentation' %}</h1> +<h1>{% translate 'Model documentation' %}</h1> {% regroup models by app_config as grouped_models %} @@ -40,7 +40,7 @@ {% block sidebar %} <div id="content-related" class="sidebar"> <div class="module"> -<h2>{% trans 'Model groups' %}</h2> +<h2>{% translate 'Model groups' %}</h2> <ul> {% regroup models by app_config as grouped_models %} {% for group in grouped_models %} diff --git a/django/contrib/admindocs/templates/admin_doc/template_detail.html b/django/contrib/admindocs/templates/admin_doc/template_detail.html index 1b95b25d39..3e2de222a8 100644 --- a/django/contrib/admindocs/templates/admin_doc/template_detail.html +++ b/django/contrib/admindocs/templates/admin_doc/template_detail.html @@ -3,25 +3,25 @@ {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> -› <a href="{% url 'django-admindocs-docroot' %}">{% trans 'Documentation' %}</a> -› {% trans 'Templates' %} +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> +› <a href="{% url 'django-admindocs-docroot' %}">{% translate 'Documentation' %}</a> +› {% translate 'Templates' %} › {{ name }} </div> {% endblock %} -{% block title %}{% blocktrans %}Template: {{ name }}{% endblocktrans %}{% endblock %} +{% block title %}{% blocktranslate %}Template: {{ name }}{% endblocktranslate %}{% endblock %} {% block content %} -<h1>{% blocktrans %}Template: <q>{{ name }}</q>{% endblocktrans %}</h1> +<h1>{% blocktranslate %}Template: <q>{{ name }}</q>{% endblocktranslate %}</h1> {# Translators: Search is not a verb here, it qualifies path (a search path) #} -<h2>{% blocktrans %}Search path for template <q>{{ name }}</q>:{% endblocktrans %}</h2> +<h2>{% blocktranslate %}Search path for template <q>{{ name }}</q>:{% endblocktranslate %}</h2> <ol> {% for template in templates|dictsort:"order" %} - <li><code>{{ template.file }}</code>{% if not template.exists %} <em>{% trans '(does not exist)' %}</em>{% endif %}</li> + <li><code>{{ template.file }}</code>{% if not template.exists %} <em>{% translate '(does not exist)' %}</em>{% endif %}</li> {% endfor %} </ol> -<p class="small"><a href="{% url 'django-admindocs-docroot' %}">‹ {% trans 'Back to Documentation' %}</a></p> +<p class="small"><a href="{% url 'django-admindocs-docroot' %}">‹ {% translate 'Back to Documentation' %}</a></p> {% endblock %} diff --git a/django/contrib/admindocs/templates/admin_doc/template_filter_index.html b/django/contrib/admindocs/templates/admin_doc/template_filter_index.html index caf983ac6d..c66b7ed3d3 100644 --- a/django/contrib/admindocs/templates/admin_doc/template_filter_index.html +++ b/django/contrib/admindocs/templates/admin_doc/template_filter_index.html @@ -4,23 +4,23 @@ {% block coltype %}colSM{% endblock %} {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> -› <a href="{% url 'django-admindocs-docroot' %}">{% trans 'Documentation' %}</a> -› {% trans 'Filters' %} +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> +› <a href="{% url 'django-admindocs-docroot' %}">{% translate 'Documentation' %}</a> +› {% translate 'Filters' %} </div> {% endblock %} -{% block title %}{% trans 'Template filters' %}{% endblock %} +{% block title %}{% translate 'Template filters' %}{% endblock %} {% block content %} -<h1>{% trans 'Template filter documentation' %}</h1> +<h1>{% translate 'Template filter documentation' %}</h1> <div id="content-main"> {% regroup filters|dictsort:"library" by library as filter_libraries %} {% for library in filter_libraries %} <div class="module"> <h2>{% firstof library.grouper _("Built-in filters") %}</h2> - {% if library.grouper %}<p class="small quiet">{% blocktrans with code="{"|add:"% load "|add:library.grouper|add:" %"|add:"}" %}To use these filters, put <code>{{ code }}</code> in your template before using the filter.{% endblocktrans %}</p><hr>{% endif %} + {% if library.grouper %}<p class="small quiet">{% blocktranslate with code="{"|add:"% load "|add:library.grouper|add:" %"|add:"}" %}To use these filters, put <code>{{ code }}</code> in your template before using the filter.{% endblocktranslate %}</p><hr>{% endif %} {% for filter in library.list|dictsort:"name" %} <h3 id="{{ library.grouper|default:"built_in" }}-{{ filter.name }}">{{ filter.name }}</h3> {{ filter.title }} diff --git a/django/contrib/admindocs/templates/admin_doc/template_tag_index.html b/django/contrib/admindocs/templates/admin_doc/template_tag_index.html index bb4f239147..17b930e337 100644 --- a/django/contrib/admindocs/templates/admin_doc/template_tag_index.html +++ b/django/contrib/admindocs/templates/admin_doc/template_tag_index.html @@ -4,23 +4,23 @@ {% block coltype %}colSM{% endblock %} {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> -› <a href="{% url 'django-admindocs-docroot' %}">{% trans 'Documentation' %}</a> -› {% trans 'Tags' %} +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> +› <a href="{% url 'django-admindocs-docroot' %}">{% translate 'Documentation' %}</a> +› {% translate 'Tags' %} </div> {% endblock %} -{% block title %}{% trans 'Template tags' %}{% endblock %} +{% block title %}{% translate 'Template tags' %}{% endblock %} {% block content %} -<h1>{% trans 'Template tag documentation' %}</h1> +<h1>{% translate 'Template tag documentation' %}</h1> <div id="content-main"> {% regroup tags|dictsort:"library" by library as tag_libraries %} {% for library in tag_libraries %} <div class="module"> <h2>{% firstof library.grouper _("Built-in tags") %}</h2> - {% if library.grouper %}<p class="small quiet">{% blocktrans with code="{"|add:"% load "|add:library.grouper|add:" %"|add:"}" %}To use these tags, put <code>{{ code }}</code> in your template before using the tag.{% endblocktrans %}</p><hr>{% endif %} + {% if library.grouper %}<p class="small quiet">{% blocktranslate with code="{"|add:"% load "|add:library.grouper|add:" %"|add:"}" %}To use these tags, put <code>{{ code }}</code> in your template before using the tag.{% endblocktranslate %}</p><hr>{% endif %} {% for tag in library.list|dictsort:"name" %} <h3 id="{{ library.grouper|default:"built_in" }}-{{ tag.name }}">{{ tag.name }}</h3> <h4>{{ tag.title|striptags }}</h4> diff --git a/django/contrib/admindocs/templates/admin_doc/view_detail.html b/django/contrib/admindocs/templates/admin_doc/view_detail.html index 39ff0e1021..945f7fb690 100644 --- a/django/contrib/admindocs/templates/admin_doc/view_detail.html +++ b/django/contrib/admindocs/templates/admin_doc/view_detail.html @@ -3,13 +3,13 @@ {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> -› <a href="{% url 'django-admindocs-docroot' %}">{% trans 'Documentation' %}</a> -› <a href="{% url 'django-admindocs-views-index' %}">{% trans 'Views' %}</a> +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> +› <a href="{% url 'django-admindocs-docroot' %}">{% translate 'Documentation' %}</a> +› <a href="{% url 'django-admindocs-views-index' %}">{% translate 'Views' %}</a> › {{ name }} </div> {% endblock %} -{% block title %}{% blocktrans %}View: {{ name }}{% endblocktrans %}{% endblock %} +{% block title %}{% blocktranslate %}View: {{ name }}{% endblocktranslate %}{% endblock %} {% block content %} @@ -20,14 +20,14 @@ {{ body }} {% if meta.Context %} -<h3>{% trans 'Context:' %}</h3> +<h3>{% translate 'Context:' %}</h3> <p>{{ meta.Context }}</p> {% endif %} {% if meta.Templates %} -<h3>{% trans 'Templates:' %}</h3> +<h3>{% translate 'Templates:' %}</h3> <p>{{ meta.Templates }}</p> {% endif %} -<p class="small"><a href="{% url 'django-admindocs-views-index' %}">‹ {% trans 'Back to View documentation' %}</a></p> +<p class="small"><a href="{% url 'django-admindocs-views-index' %}">‹ {% translate 'Back to View documentation' %}</a></p> {% endblock %} diff --git a/django/contrib/admindocs/templates/admin_doc/view_index.html b/django/contrib/admindocs/templates/admin_doc/view_index.html index 77b3e40b1d..873303f2b2 100644 --- a/django/contrib/admindocs/templates/admin_doc/view_index.html +++ b/django/contrib/admindocs/templates/admin_doc/view_index.html @@ -4,27 +4,27 @@ {% block coltype %}colSM{% endblock %} {% block breadcrumbs %} <div class="breadcrumbs"> -<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a> -› <a href="{% url 'django-admindocs-docroot' %}">{% trans 'Documentation' %}</a> -› {% trans 'Views' %} +<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a> +› <a href="{% url 'django-admindocs-docroot' %}">{% translate 'Documentation' %}</a> +› {% translate 'Views' %} </div> {% endblock %} -{% block title %}{% trans 'Views' %}{% endblock %} +{% block title %}{% translate 'Views' %}{% endblock %} {% block content %} -<h1>{% trans 'View documentation' %}</h1> +<h1>{% translate 'View documentation' %}</h1> {% regroup views|dictsort:'namespace' by namespace as views_by_ns %} <div id="content-related" class="sidebar"> <div class="module"> -<h2>{% trans 'Jump to namespace' %}</h2> +<h2>{% translate 'Jump to namespace' %}</h2> <ul> {% for ns_views in views_by_ns %} <li><a href="#ns|{{ ns_views.grouper }}"> {% if ns_views.grouper %}{{ ns_views.grouper }} - {% else %}{% trans "Empty namespace" %}{% endif %} + {% else %}{% translate "Empty namespace" %}{% endif %} </a></li> {% endfor %} </ul> @@ -37,18 +37,18 @@ <div class="module"> <h2 id="ns|{{ ns_views.grouper }}"> {% if ns_views.grouper %} - {% blocktrans with ns_views.grouper as name %}Views by namespace {{ name }}{% endblocktrans %} + {% blocktranslate with ns_views.grouper as name %}Views by namespace {{ name }}{% endblocktranslate %} {% else %} - {% blocktrans %}Views by empty namespace{% endblocktrans %} + {% blocktranslate %}Views by empty namespace{% endblocktranslate %} {% endif %} </h2> {% for view in ns_views.list|dictsort:"url" %} {% ifchanged %} <h3><a href="{% url 'django-admindocs-views-detail' view=view.full_name %}">{{ view.url }}</a></h3> -<p class="small quiet">{% blocktrans with view.full_name as full_name and view.url_name as url_name %} +<p class="small quiet">{% blocktranslate with view.full_name as full_name and view.url_name as url_name %} View function: <code>{{ full_name }}</code>. Name: <code>{{ url_name }}</code>. -{% endblocktrans %}</p> +{% endblocktranslate %}</p> <p>{{ view.title }}</p> <hr> {% endifchanged %} diff --git a/django/contrib/auth/templates/registration/password_reset_subject.txt b/django/contrib/auth/templates/registration/password_reset_subject.txt index 45a354b999..eb30fcbabc 100644 --- a/django/contrib/auth/templates/registration/password_reset_subject.txt +++ b/django/contrib/auth/templates/registration/password_reset_subject.txt @@ -1,3 +1,3 @@ {% load i18n %}{% autoescape off %} -{% blocktrans %}Password reset on {{ site_name }}{% endblocktrans %} +{% blocktranslate %}Password reset on {{ site_name }}{% endblocktranslate %} {% endautoescape %} \ No newline at end of file diff --git a/django/contrib/gis/templates/gis/admin/openlayers.html b/django/contrib/gis/templates/gis/admin/openlayers.html index cc9bea3efd..9ba1bd0c1e 100644 --- a/django/contrib/gis/templates/gis/admin/openlayers.html +++ b/django/contrib/gis/templates/gis/admin/openlayers.html @@ -32,9 +32,9 @@ </script> <div id="{{ id }}_map"{% if LANGUAGE_BIDI %} dir="ltr"{% endif %}></div> {% if editable %} -<a href="javascript:{{ module }}.clearFeatures()">{% trans "Delete all Features" %}</a> +<a href="javascript:{{ module }}.clearFeatures()">{% translate "Delete all Features" %}</a> {% endif %} -{% if display_wkt %}<p>{% trans "WKT debugging window:" %} </p>{% endif %} +{% if display_wkt %}<p>{% translate "WKT debugging window:" %} </p>{% endif %} <textarea id="{{ id }}" class="vWKTField required" cols="150" rows="10" name="{{ name }}">{{ wkt }}</textarea> <script>{% block init_function %}{{ module }}.init();{% endblock %}</script> </span> diff --git a/django/contrib/gis/templates/gis/openlayers.html b/django/contrib/gis/templates/gis/openlayers.html index 88288a3cb7..90ecf1b44b 100644 --- a/django/contrib/gis/templates/gis/openlayers.html +++ b/django/contrib/gis/templates/gis/openlayers.html @@ -9,8 +9,8 @@ <div id="{{ id }}_div_map"> <div id="{{ id }}_map"></div> - {% if not disabled %}<span class="clear_features"><a href="javascript:{{ module }}.clearFeatures()">{% trans "Delete all Features" %}</a></span>{% endif %} - {% if display_raw %}<p>{% trans "Debugging window (serialized value)" %}</p>{% endif %} + {% if not disabled %}<span class="clear_features"><a href="javascript:{{ module }}.clearFeatures()">{% translate "Delete all Features" %}</a></span>{% endif %} + {% if display_raw %}<p>{% translate "Debugging window (serialized value)" %}</p>{% endif %} <textarea id="{{ id }}" class="vSerializedField required" cols="150" rows="10" name="{{ name }}">{{ serialized }}</textarea> <script> {% block map_options %}var map_options = {};{% endblock %} diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index d010bc7560..7ab21b320e 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -1418,10 +1418,10 @@ def widthratio(parser, token): (because 175/200 = .875; .875 * 100 = 87.5 which is rounded up to 88). In some cases you might want to capture the result of widthratio in a - variable. It can be useful for instance in a blocktrans like this:: + variable. It can be useful for instance in a blocktranslate like this:: {% widthratio this_value max_value max_width as width %} - {% blocktrans %}The width is: {{ width }}{% endblocktrans %} + {% blocktranslate %}The width is: {{ width }}{% endblocktranslate %} """ bits = token.split_contents() if len(bits) == 4: diff --git a/django/templatetags/i18n.py b/django/templatetags/i18n.py index 5618c88bd4..d0fda0797e 100644 --- a/django/templatetags/i18n.py +++ b/django/templatetags/i18n.py @@ -324,7 +324,7 @@ def do_translate(parser, token): Usage:: - {% trans "this is a test" %} + {% translate "this is a test" %} This marks the string for translation so it will be pulled out by makemessages into the .po files and runs the string through the translation @@ -332,7 +332,7 @@ def do_translate(parser, token): There is a second form:: - {% trans "this is a test" noop %} + {% translate "this is a test" noop %} This marks the string for translation, but returns the string unchanged. Use it when you need to store values into forms that should be translated @@ -341,19 +341,19 @@ def do_translate(parser, token): You can use variables instead of constant strings to translate stuff you marked somewhere else:: - {% trans variable %} + {% translate variable %} This tries to translate the contents of the variable ``variable``. Make sure that the string in there is something that is in the .po file. It is possible to store the translated string into a variable:: - {% trans "this is a test" as var %} + {% translate "this is a test" as var %} {{ var }} Contextual translations are also supported:: - {% trans "this is a test" context "greeting" %} + {% translate "this is a test" context "greeting" %} This is equivalent to calling pgettext instead of (u)gettext. """ @@ -417,37 +417,37 @@ def do_block_translate(parser, token): Usage:: - {% blocktrans with bar=foo|filter boo=baz|filter %} + {% blocktranslate with bar=foo|filter boo=baz|filter %} This is {{ bar }} and {{ boo }}. - {% endblocktrans %} + {% endblocktranslate %} Additionally, this supports pluralization:: - {% blocktrans count count=var|length %} + {% blocktranslate count count=var|length %} There is {{ count }} object. {% plural %} There are {{ count }} objects. - {% endblocktrans %} + {% endblocktranslate %} This is much like ngettext, only in template syntax. The "var as value" legacy format is still supported:: - {% blocktrans with foo|filter as bar and baz|filter as boo %} - {% blocktrans count var|length as count %} + {% blocktranslate with foo|filter as bar and baz|filter as boo %} + {% blocktranslate count var|length as count %} The translated string can be stored in a variable using `asvar`:: - {% blocktrans with bar=foo|filter boo=baz|filter asvar var %} + {% blocktranslate with bar=foo|filter boo=baz|filter asvar var %} This is {{ bar }} and {{ boo }}. - {% endblocktrans %} + {% endblocktranslate %} {{ var }} Contextual translations are supported:: - {% blocktrans with bar=foo|filter context "greeting" %} + {% blocktranslate with bar=foo|filter context "greeting" %} This is {{ bar }}. - {% endblocktrans %} + {% endblocktranslate %} This is equivalent to calling pgettext/npgettext instead of (u)gettext/(u)ngettext. diff --git a/django/views/static.py b/django/views/static.py index 541abc66c5..3477ca57b7 100644 --- a/django/views/static.py +++ b/django/views/static.py @@ -62,10 +62,10 @@ DEFAULT_DIRECTORY_INDEX_TEMPLATE = """ <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Language" content="en-us"> <meta name="robots" content="NONE,NOARCHIVE"> - <title>{% blocktrans %}Index of {{ directory }}{% endblocktrans %}</title> + <title>{% blocktranslate %}Index of {{ directory }}{% endblocktranslate %}</title> </head> <body> - <h1>{% blocktrans %}Index of {{ directory }}{% endblocktrans %}</h1> + <h1>{% blocktranslate %}Index of {{ directory }}{% endblocktranslate %}</h1> <ul> {% if directory != "/" %} <li><a href="../">../</a></li> diff --git a/django/views/templates/default_urlconf.html b/django/views/templates/default_urlconf.html index 0a79ea72aa..9a84063451 100644 --- a/django/views/templates/default_urlconf.html +++ b/django/views/templates/default_urlconf.html @@ -4,7 +4,7 @@ <html{% if LANGUAGE_BIDI %} dir="rtl"{% endif %}> <head> <meta charset="utf-8"> - <title>{% trans "Django: the Web framework for perfectionists with deadlines." %}</title> + <title>{% translate "Django: the Web framework for perfectionists with deadlines." %}</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" type="text/css" href="/static/admin/css/fonts.css"> <style type="text/css"> @@ -343,7 +343,7 @@ </a> </div> <div class="release-notes"> - <p>{% blocktrans %}View <a href="https://docs.djangoproject.com/en/{{ version }}/releases/" target="_blank" rel="noopener">release notes</a> for Django {{ version }}{% endblocktrans %}</p> + <p>{% blocktranslate %}View <a href="https://docs.djangoproject.com/en/{{ version }}/releases/" target="_blank" rel="noopener">release notes</a> for Django {{ version }}{% endblocktranslate %}</p> </div> </header> <main> @@ -365,8 +365,8 @@ <path class="flame" d="M 6.7 1.14 l 2.8 4.7 s 1.3 3 -1.82 3.22 l -5.4 0 s -3.28 -.14 -1.74 -3.26 l 2.76 -4.7 s 1.7 -2.3 3.4 0 z" fill="#AA2247"></path> </svg> </div> - <h2>{% trans "The install worked successfully! Congratulations!" %}</h2> - <p>{% blocktrans %}You are seeing this page because <a href="https://docs.djangoproject.com/en/{{ version }}/ref/settings/#debug" target="_blank" rel="noopener">DEBUG=True</a> is in your settings file and you have not configured any URLs.{% endblocktrans %}</p> + <h2>{% translate "The install worked successfully! Congratulations!" %}</h2> + <p>{% blocktranslate %}You are seeing this page because <a href="https://docs.djangoproject.com/en/{{ version }}/ref/settings/#debug" target="_blank" rel="noopener">DEBUG=True</a> is in your settings file and you have not configured any URLs.{% endblocktranslate %}</p> </main> <footer class="u-clearfix"> <a href="https://docs.djangoproject.com/en/{{ version }}/" target="_blank" rel="noopener"> @@ -381,8 +381,8 @@ <path clip-path="url(#b)" d="M9 21c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-1H9v1zm3-19C8.14 2 5 5.14 5 9c0 2.38 1.19 4.47 3 5.74V17c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2.26c1.81-1.27 3-3.36 3-5.74 0-3.86-3.14-7-7-7zm2.85 11.1l-.85.6V16h-4v-2.3l-.85-.6C7.8 12.16 7 10.63 7 9c0-2.76 2.24-5 5-5s5 2.24 5 5c0 1.63-.8 3.16-2.15 4.1z"></path> </svg> <div> - <h4>{% trans "Django Documentation" %}</h4> - <p>{% trans 'Topics, references, & how-to’s' %}</p> + <h4>{% translate "Django Documentation" %}</h4> + <p>{% translate 'Topics, references, & how-to’s' %}</p> </div> </div> </a> @@ -393,8 +393,8 @@ <path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"></path> </svg> <div> - <h4>{% trans "Tutorial: A Polling App" %}</h4> - <p>{% trans "Get started with Django" %}</p> + <h4>{% translate "Tutorial: A Polling App" %}</h4> + <p>{% translate "Get started with Django" %}</p> </div> </div> </a> @@ -405,8 +405,8 @@ <path d="M16.5 13c-1.2 0-3.07.34-4.5 1-1.43-.67-3.3-1-4.5-1C5.33 13 1 14.08 1 16.25V19h22v-2.75c0-2.17-4.33-3.25-6.5-3.25zm-4 4.5h-10v-1.25c0-.54 2.56-1.75 5-1.75s5 1.21 5 1.75v1.25zm9 0H14v-1.25c0-.46-.2-.86-.52-1.22.88-.3 1.96-.53 3.02-.53 2.44 0 5 1.21 5 1.75v1.25zM7.5 12c1.93 0 3.5-1.57 3.5-3.5S9.43 5 7.5 5 4 6.57 4 8.5 5.57 12 7.5 12zm0-5.5c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zm9 5.5c1.93 0 3.5-1.57 3.5-3.5S18.43 5 16.5 5 13 6.57 13 8.5s1.57 3.5 3.5 3.5zm0-5.5c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2z"></path> </svg> <div> - <h4>{% trans "Django Community" %}</h4> - <p>{% trans "Connect, get help, or contribute" %}</p> + <h4>{% translate "Django Community" %}</h4> + <p>{% translate "Connect, get help, or contribute" %}</p> </div> </div> </a> diff --git a/tests/admin_views/templates/admin/admin_views/article/actions.html b/tests/admin_views/templates/admin/admin_views/article/actions.html index 9aa238fd2a..d66ad304a2 100644 --- a/tests/admin_views/templates/admin/admin_views/article/actions.html +++ b/tests/admin_views/templates/admin/admin_views/article/actions.html @@ -2,5 +2,5 @@ {% load i18n %} {% block actions-submit %} -<button type="submit" class="button override-actions" title="{% trans "Run the selected action" %}" name="index" value="{{ action_index|default:0 }}">{% trans "Go" %}</button> +<button type="submit" class="button override-actions" title="{% translate "Run the selected action" %}" name="index" value="{{ action_index|default:0 }}">{% translate "Go" %}</button> {% endblock %} diff --git a/tests/admin_views/templates/admin/admin_views/article/change_form_object_tools.html b/tests/admin_views/templates/admin/admin_views/article/change_form_object_tools.html index 609974bb95..d141664daf 100644 --- a/tests/admin_views/templates/admin/admin_views/article/change_form_object_tools.html +++ b/tests/admin_views/templates/admin/admin_views/article/change_form_object_tools.html @@ -2,6 +2,6 @@ {% load i18n admin_urls %} {% block object-tools-items %} -<li><a href="#" id="change-form-export" class="override-change_form_object_tools change-form-object-tools-item">{% trans "Export" %}</a></li> +<li><a href="#" id="change-form-export" class="override-change_form_object_tools change-form-object-tools-item">{% translate "Export" %}</a></li> {{ block.super }} {% endblock %} diff --git a/tests/admin_views/templates/admin/admin_views/article/change_list_object_tools.html b/tests/admin_views/templates/admin/admin_views/article/change_list_object_tools.html index 1a9be91952..b366807da4 100644 --- a/tests/admin_views/templates/admin/admin_views/article/change_list_object_tools.html +++ b/tests/admin_views/templates/admin/admin_views/article/change_list_object_tools.html @@ -2,6 +2,6 @@ {% load i18n admin_urls %} {% block object-tools-items %} -<li><a href="#" id="change-list-export" class="override-change_list_object_tools change-list-object-tools-item">{% trans "Export" %}</a></li> +<li><a href="#" id="change-list-export" class="override-change_list_object_tools change-list-object-tools-item">{% translate "Export" %}</a></li> {{ block.super }} {% endblock %} diff --git a/tests/admin_views/templates/admin/admin_views/article/change_list_results.html b/tests/admin_views/templates/admin/admin_views/article/change_list_results.html index ceb581f8ef..ca36f3abcf 100644 --- a/tests/admin_views/templates/admin/admin_views/article/change_list_results.html +++ b/tests/admin_views/templates/admin/admin_views/article/change_list_results.html @@ -14,9 +14,9 @@ {% if header.sortable %} {% if header.sort_priority > 0 %} <div class="sortoptions"> - <a class="sortremove" href="{{ header.url_remove }}" title="{% trans "Remove from sorting" %}"></a> - {% if num_sorted_fields > 1 %}<span class="sortpriority" title="{% blocktrans with priority_number=header.sort_priority %}Sorting priority: {{ priority_number }}{% endblocktrans %}">{{ header.sort_priority }}</span>{% endif %} - <a href="{{ header.url_toggle }}" class="toggle {% if header.ascending %}ascending{% else %}descending{% endif %}" title="{% trans "Toggle sorting" %}"></a> + <a class="sortremove" href="{{ header.url_remove }}" title="{% translate "Remove from sorting" %}"></a> + {% if num_sorted_fields > 1 %}<span class="sortpriority" title="{% blocktranslate with priority_number=header.sort_priority %}Sorting priority: {{ priority_number }}{% endblocktranslate %}">{{ header.sort_priority }}</span>{% endif %} + <a href="{{ header.url_toggle }}" class="toggle {% if header.ascending %}ascending{% else %}descending{% endif %}" title="{% translate "Toggle sorting" %}"></a> </div> {% endif %} {% endif %} diff --git a/tests/admin_views/templates/admin/admin_views/article/date_hierarchy.html b/tests/admin_views/templates/admin/admin_views/article/date_hierarchy.html index de1cb747b5..8f76bea8f9 100644 --- a/tests/admin_views/templates/admin/admin_views/article/date_hierarchy.html +++ b/tests/admin_views/templates/admin/admin_views/article/date_hierarchy.html @@ -5,5 +5,5 @@ <select id="date-selector" class="override-date_hierarchy">{% for choice in choices %} <option{% if choice.link %} value="{{ choice.link }}"{% endif %}>{{ choice.title }}</option> {% endfor %}</select> -<button id="date-selected">{% trans "Go" %}</button> +<button id="date-selected">{% translate "Go" %}</button> {% endblock %} diff --git a/tests/admin_views/templates/admin/admin_views/article/pagination.html b/tests/admin_views/templates/admin/admin_views/article/pagination.html index e072cacd3c..e712b7d2d7 100644 --- a/tests/admin_views/templates/admin/admin_views/article/pagination.html +++ b/tests/admin_views/templates/admin/admin_views/article/pagination.html @@ -7,6 +7,6 @@ {% endfor %} {% endif %} {{ cl.result_count }} {% if cl.result_count == 1 %}{{ cl.opts.verbose_name }}{% else %}{{ cl.opts.verbose_name_plural }}{% endif %} -{% if show_all_url %} <a href="{{ show_all_url }}" class="showall">{% trans 'Show all' %}</a>{% endif %} -{% if cl.formset and cl.result_count %}<input type="submit" name="_save" class="default" value="{% trans 'Save' %}"/>{% endif %} +{% if show_all_url %} <a href="{{ show_all_url }}" class="showall">{% translate 'Show all' %}</a>{% endif %} +{% if cl.formset and cl.result_count %}<input type="submit" name="_save" class="default" value="{% translate 'Save' %}"/>{% endif %} </p> diff --git a/tests/admin_views/templates/admin/admin_views/article/search_form.html b/tests/admin_views/templates/admin/admin_views/article/search_form.html index 5b5e6a58f6..eef986cb30 100644 --- a/tests/admin_views/templates/admin/admin_views/article/search_form.html +++ b/tests/admin_views/templates/admin/admin_views/article/search_form.html @@ -4,9 +4,9 @@ <div><!-- DIV needed for valid HTML --> <label for="searchbar"><img src="{% static "admin/img/search.svg" %}" alt="Search" /></label> <input type="text" size="40" name="{{ search_var }}" value="{{ cl.query }}" id="searchbar" autofocus /> -<input type="submit" value="{% trans 'Search' %}" /> +<input type="submit" value="{% translate 'Search' %}" /> {% if show_result_count %} - <span class="small quiet">{% blocktrans count counter=cl.result_count %}{{ counter }} result{% plural %}{{ counter }} results{% endblocktrans %} (<a href="?{% if cl.is_popup %}_popup=1{% endif %}">{% if cl.show_full_result_count %}{% blocktrans with full_result_count=cl.full_result_count %}{{ full_result_count }} total{% endblocktrans %}{% else %}{% trans "Show all" %}{% endif %}</a>)</span> + <span class="small quiet">{% blocktranslate count counter=cl.result_count %}{{ counter }} result{% plural %}{{ counter }} results{% endblocktranslate %} (<a href="?{% if cl.is_popup %}_popup=1{% endif %}">{% if cl.show_full_result_count %}{% blocktranslate with full_result_count=cl.full_result_count %}{{ full_result_count }} total{% endblocktranslate %}{% else %}{% translate "Show all" %}{% endif %}</a>)</span> {% endif %} {% for pair in cl.params.items %} {% if pair.0 != search_var %}<input type="hidden" name="{{ pair.0 }}" value="{{ pair.1 }}"/>{% endif %} diff --git a/tests/admin_views/templates/admin/admin_views/article/submit_line.html b/tests/admin_views/templates/admin/admin_views/article/submit_line.html index 4a2ca08890..97554b5571 100644 --- a/tests/admin_views/templates/admin/admin_views/article/submit_line.html +++ b/tests/admin_views/templates/admin/admin_views/article/submit_line.html @@ -2,6 +2,6 @@ {% load i18n admin_urls %} {% block submit-row %} -{% if show_publish %}<input type="submit" value="{% trans 'Publish' %}" class="default" name="_publish" />{% endif %} +{% if show_publish %}<input type="submit" value="{% translate 'Publish' %}" class="default" name="_publish" />{% endif %} {{ block.super }} {% endblock %} diff --git a/tests/i18n/commands/ignore_dir/ignored.html b/tests/i18n/commands/ignore_dir/ignored.html index 6a296787ef..037df44020 100644 --- a/tests/i18n/commands/ignore_dir/ignored.html +++ b/tests/i18n/commands/ignore_dir/ignored.html @@ -1,2 +1,2 @@ {% load i18n %} -{% trans "This should be ignored." %} +{% translate "This should be ignored." %} diff --git a/tests/i18n/commands/templates/comments.thtml b/tests/i18n/commands/templates/comments.thtml index 90eb5f1792..50249d911e 100644 --- a/tests/i18n/commands/templates/comments.thtml +++ b/tests/i18n/commands/templates/comments.thtml @@ -1,13 +1,13 @@ {% load i18n %} -{# ignored comment #1 #}{% trans "Translatable literal #9a" %} -{# Translators: ignored i18n comment #1 #}{% trans "Translatable literal #9b" %} -{# Translators: ignored i18n comment #2 #}{# ignored comment #2 #}{% trans "Translatable literal #9c" %} -{# ignored comment #3 #}{# Translators: ignored i18n comment #3 #}{% trans "Translatable literal #9d" %} -{# ignored comment #4 #}{% trans "Translatable literal #9e" %}{# ignored comment #5 #} -{# Translators: ignored i18n comment #4 #}{% trans "Translatable literal #9f" %}{# Translators: valid i18n comment #5 #} -{% trans "Translatable literal #9g" %}{# Translators: valid i18n comment #6 #} -{# ignored comment #6 #}{% trans "Translatable literal #9h" %}{# Translators: valid i18n comment #7 #} -{% trans "Translatable literal #9i" %} +{# ignored comment #1 #}{% translate "Translatable literal #9a" %} +{# Translators: ignored i18n comment #1 #}{% translate "Translatable literal #9b" %} +{# Translators: ignored i18n comment #2 #}{# ignored comment #2 #}{% translate "Translatable literal #9c" %} +{# ignored comment #3 #}{# Translators: ignored i18n comment #3 #}{% translate "Translatable literal #9d" %} +{# ignored comment #4 #}{% translate "Translatable literal #9e" %}{# ignored comment #5 #} +{# Translators: ignored i18n comment #4 #}{% translate "Translatable literal #9f" %}{# Translators: valid i18n comment #5 #} +{% translate "Translatable literal #9g" %}{# Translators: valid i18n comment #6 #} +{# ignored comment #6 #}{% translate "Translatable literal #9h" %}{# Translators: valid i18n comment #7 #} +{% translate "Translatable literal #9i" %} {# Translators: valid i18n comment #8 #}{# Translators: valid i18n comment #9 #} -{% trans "Translatable literal #9j" %} +{% translate "Translatable literal #9j" %} diff --git a/tests/i18n/commands/templates/plural.djtpl b/tests/i18n/commands/templates/plural.djtpl index fc37855d20..f01565bf18 100644 --- a/tests/i18n/commands/templates/plural.djtpl +++ b/tests/i18n/commands/templates/plural.djtpl @@ -3,6 +3,6 @@ This file has a literal with plural forms. When processed first, makemessages shouldn't create a .po file with duplicate `Plural-Forms` headers {% endcomment %} -{% blocktrans count number=3 %}{{ number }} Bar{% plural %}{{ number }} Bars{% endblocktrans %} +{% blocktranslate count number=3 %}{{ number }} Bar{% plural %}{{ number }} Bars{% endblocktranslate %} {% translate 'First `translate`, then `blocktranslate` with a plural' %} diff --git a/tests/i18n/commands/templates/subdir/ignored.html b/tests/i18n/commands/templates/subdir/ignored.html index d36a6fe881..86fdecc94a 100644 --- a/tests/i18n/commands/templates/subdir/ignored.html +++ b/tests/i18n/commands/templates/subdir/ignored.html @@ -1,2 +1,2 @@ {% load i18n %} -{% trans "This subdir should be ignored too." %} +{% translate "This subdir should be ignored too." %} diff --git a/tests/i18n/commands/templates/template_with_error.tpl b/tests/i18n/commands/templates/template_with_error.tpl index c2b93bdd06..d427098bdf 100644 --- a/tests/i18n/commands/templates/template_with_error.tpl +++ b/tests/i18n/commands/templates/template_with_error.tpl @@ -1,3 +1,3 @@ {% load i18n %} -<p>This template contains an error (no endblocktrans)</p> -<p>{% blocktrans %}This should fail{% blocktrans %}</p> +<p>This template contains an error (no endblocktranslate)</p> +<p>{% blocktranslate %}This should fail{% blocktranslate %}</p> diff --git a/tests/i18n/commands/templates/test.html b/tests/i18n/commands/templates/test.html index 0671a68860..acac1a1149 100644 --- a/tests/i18n/commands/templates/test.html +++ b/tests/i18n/commands/templates/test.html @@ -2,103 +2,104 @@ {% comment %}Translators: Django comment block for translators string's meaning unveiled {% endcomment %} -{% trans "This literal should be included." %} -{% trans "This literal should also be included wrapped or not wrapped depending on the use of the --no-wrap option." %} +{% translate "This literal should be included." %} +{% translate "This literal should also be included wrapped or not wrapped depending on the use of the --no-wrap option." %} {% comment %}Some random comment Some random comment Translators: One-line translator comment #1 {% endcomment %} -{% trans "Translatable literal #1a" %} +{% translate "Translatable literal #1a" %} {% comment %}Some random comment Some random comment Translators: Two-line translator comment #1 continued here. {% endcomment %} -{% trans "Translatable literal #1b" %} +{% translate "Translatable literal #1b" %} {% comment %}Some random comment Translators: One-line translator comment #2 {% endcomment %} -{% trans "Translatable literal #2a" %} +{% translate "Translatable literal #2a" %} {% comment %}Some random comment Translators: Two-line translator comment #2 continued here. {% endcomment %} -{% trans "Translatable literal #2b" %} +{% translate "Translatable literal #2b" %} {% comment %} Translators: One-line translator comment #3 {% endcomment %} -{% trans "Translatable literal #3a" %} +{% translate "Translatable literal #3a" %} {% comment %} Translators: Two-line translator comment #3 continued here. {% endcomment %} -{% trans "Translatable literal #3b" %} +{% translate "Translatable literal #3b" %} {% comment %} Translators: One-line translator comment #4{% endcomment %} -{% trans "Translatable literal #4a" %} +{% translate "Translatable literal #4a" %} {% comment %} Translators: Two-line translator comment #4 continued here.{% endcomment %} -{% trans "Translatable literal #4b" %} +{% translate "Translatable literal #4b" %} {% comment %} Translators: One-line translator comment #5 -- with non ASCII characters: áéíóúö{% endcomment %} -{% trans "Translatable literal #5a" %} +{% translate "Translatable literal #5a" %} {% comment %} Translators: Two-line translator comment #5 -- with non ASCII characters: áéíóúö continued here.{% endcomment %} -{% trans "Translatable literal #6b" %} +{% translate "Translatable literal #6b" %} -{% trans "Translatable literal #7a" context "Special trans context #1" %} -{% trans "Translatable literal #7b" as var context "Special trans context #2" %} -{% trans "Translatable literal #7c" context "Special trans context #3" as var %} +{% translate "Translatable literal #7a" context "Special trans context #1" %} +{% translate "Translatable literal #7b" as var context "Special trans context #2" %} +{% translate "Translatable literal #7c" context "Special trans context #3" as var %} -{% trans "Translatable literal #7.1a" | upper context "context #7.1a" %} -{% trans "Translatable literal #7.1b" |upper as var context "context #7.1b" %} -{% trans "Translatable literal #7.1c"| upper context "context #7.1c" as var %} +{% translate "Translatable literal #7.1a" | upper context "context #7.1a" %} +{% translate "Translatable literal #7.1b" |upper as var context "context #7.1b" %} +{% translate "Translatable literal #7.1c"| upper context "context #7.1c" as var %} -{% trans "Translatable literal #7.1d"|add:" foo" context "context #7.1d" %} -{% trans "Translatable literal #7.1e"|add:' ûè本' as var context "context #7.1e" %} +{% translate "Translatable literal #7.1d"|add:" foo" context "context #7.1d" %} +{% translate "Translatable literal #7.1e"|add:' ûè本' as var context "context #7.1e" %} {% with foo=" foo" %} - {% trans "Translatable literal #7.1f"|add:foo context "context #7.1f" as var %} + {% translate "Translatable literal #7.1f"|add:foo context "context #7.1f" as var %} {% endwith %} -{% trans "Translatable literal #7.1g"|add:2 context "context #7.1g" as var %} -{% trans "Translatable literal #7.1h" | add:"foo" | add:2 context "context #7.1h" as var %} +{% translate "Translatable literal #7.1g"|add:2 context "context #7.1g" as var %} +{% translate "Translatable literal #7.1h" | add:"foo" | add:2 context "context #7.1h" as var %} <!-- Source file inside a msgid, should be left as-is. --> -{% trans "#: templates/test.html.py" %} +{% translate "#: templates/test.html.py" %} <!-- Deliberate duplicated string. --> -{% trans "This literal should be included." %} +{% translate "This literal should be included." %} -{% blocktrans context "Special blocktrans context #1" %}Translatable literal #8a{% endblocktrans %} -{% blocktrans count 2 context "Special blocktrans context #2" %}Translatable literal #8b-singular{% plural %}Translatable literal #8b-plural{% endblocktrans %} -{% blocktrans context "Special blocktrans context #3" count 2 %}Translatable literal #8c-singular{% plural %}Translatable literal #8c-plural{% endblocktrans %} -{% blocktrans with a=1 context "Special blocktrans context #4" %}Translatable literal #8d {{ a }}{% endblocktrans %} +{% blocktranslate context "Special blocktranslate context #1" %}Translatable literal #8a{% endblocktranslate %} +{% blocktranslate count 2 context "Special blocktranslate context #2" %}Translatable literal #8b-singular{% plural %}Translatable literal #8b-plural{% endblocktranslate %} +{% blocktranslate context "Special blocktranslate context #3" count 2 %}Translatable literal #8c-singular{% plural %}Translatable literal #8c-plural{% endblocktranslate %} +{% blocktranslate with a=1 context "Special blocktranslate context #4" %}Translatable literal #8d {{ a }}{% endblocktranslate %} -{% trans "Translatable literal with context wrapped in single quotes" context 'Context wrapped in single quotes' as var %} -{% trans "Translatable literal with context wrapped in double quotes" context "Context wrapped in double quotes" as var %} -{% blocktrans context 'Special blocktrans context wrapped in single quotes' %}Translatable literal with context wrapped in single quotes{% endblocktrans %} -{% blocktrans context "Special blocktrans context wrapped in double quotes" %}Translatable literal with context wrapped in double quotes{% endblocktrans %} +{% translate "Translatable literal with context wrapped in single quotes" context 'Context wrapped in single quotes' as var %} +{% translate "Translatable literal with context wrapped in double quotes" context "Context wrapped in double quotes" as var %} +{% blocktranslate context 'Special blocktranslate context wrapped in single quotes' %}Translatable literal with context wrapped in single quotes{% endblocktranslate %} +{% blocktranslate context "Special blocktranslate context wrapped in double quotes" %}Translatable literal with context wrapped in double quotes{% endblocktranslate %} -{% blocktranslate %}blocktranslate text{% endblocktranslate %} -{% translate "translate text" %} +{# Backwards compatability tests #} +{% blocktrans %}blocktrans text{% endblocktrans %} +{% trans "trans text" %} {# BasicExtractorTests.test_blocktranslate_trimmed #} {% blocktranslate %} Text with a few line breaks. -{% endblocktrans %} -{% blocktrans trimmed %} +{% endblocktranslate %} +{% blocktranslate trimmed %} Again some text with a few line breaks, this time should be trimmed. -{% endblocktrans %} -{% trans "Get my line number" %} +{% endblocktranslate %} +{% translate "Get my line number" %} {% blocktranslate trimmed count counter=mylist|length %} First `translate`, then `blocktranslate` with a plural @@ -106,4 +107,4 @@ First `translate`, then `blocktranslate` with a plural Plural for a `translate` and `blocktranslate` collision case {% endblocktranslate %} -{% trans "Non-breaking space :" %} +{% translate "Non-breaking space :" %} diff --git a/tests/i18n/commands/templates/xxx_ignored.html b/tests/i18n/commands/templates/xxx_ignored.html index a41cbe202a..52e57c5a2b 100644 --- a/tests/i18n/commands/templates/xxx_ignored.html +++ b/tests/i18n/commands/templates/xxx_ignored.html @@ -1,2 +1,2 @@ {% load i18n %} -{% trans "This should be ignored too." %} +{% translate "This should be ignored too." %} diff --git a/tests/i18n/sampleproject/templates/percents.html b/tests/i18n/sampleproject/templates/percents.html index 506c0610c5..48a543a864 100644 --- a/tests/i18n/sampleproject/templates/percents.html +++ b/tests/i18n/sampleproject/templates/percents.html @@ -1,12 +1,12 @@ {% load i18n %} -{% trans "Literal with a percent symbol at the end %" %} -{% trans "Literal with a percent % symbol in the middle" %} +{% translate "Literal with a percent symbol at the end %" %} +{% translate "Literal with a percent % symbol in the middle" %} -{% trans "It is 100%" %} -{% trans "It is 100%" context "female" %} -{% trans "Looks like a str fmt spec %s but should not be interpreted as such" %} -{% trans "Looks like a str fmt spec % o but should not be interpreted as such" %} +{% translate "It is 100%" %} +{% translate "It is 100%" context "female" %} +{% translate "Looks like a str fmt spec %s but should not be interpreted as such" %} +{% translate "Looks like a str fmt spec % o but should not be interpreted as such" %} -{% trans "1 percent sign %, 2 percent signs %%, 3 percent signs %%%" %} -{% blocktrans with name="Simon" %}{{name}} says: 1 percent sign %, 2 percent signs %%{% endblocktrans %} +{% translate "1 percent sign %, 2 percent signs %%, 3 percent signs %%%" %} +{% blocktranslate with name="Simon" %}{{name}} says: 1 percent sign %, 2 percent signs %%{% endblocktranslate %} diff --git a/tests/i18n/sampleproject/update_catalogs.py b/tests/i18n/sampleproject/update_catalogs.py index 8c57307f47..55bf1656a2 100755 --- a/tests/i18n/sampleproject/update_catalogs.py +++ b/tests/i18n/sampleproject/update_catalogs.py @@ -13,8 +13,7 @@ blocktranslate. This issue is difficult to debug, it could be a problem with extraction, interpolation, or both. How this script helps: - * Add {% translate "Two %% Three %%%" %} and blocktranslate equivalent to - templates. + * Add {% translate "Two %% Three %%%" %} and blocktranslate equivalent to templates. * Run this script. * Test extraction - verify the new msgid in sampleproject's django.po. * Add a translation to sampleproject's django.po. diff --git a/tests/i18n/test_extraction.py b/tests/i18n/test_extraction.py index db66ea1db5..709a6133f5 100644 --- a/tests/i18n/test_extraction.py +++ b/tests/i18n/test_extraction.py @@ -197,7 +197,7 @@ class BasicExtractorTests(ExtractorTests): def test_extraction_error(self): msg = ( - 'Translation blocks must not include other block tags: blocktrans ' + 'Translation blocks must not include other block tags: blocktranslate ' '(file %s, line 3)' % os.path.join('templates', 'template_with_error.tpl') ) with self.assertRaisesMessage(SyntaxError, msg): @@ -224,14 +224,14 @@ class BasicExtractorTests(ExtractorTests): def test_template_message_context_extractor(self): """ - Message contexts are correctly extracted for the {% trans %} and - {% blocktrans %} template tags (#14806). + Message contexts are correctly extracted for the {% translate %} and + {% blocktranslate %} template tags (#14806). """ management.call_command('makemessages', locale=[LOCALE], verbosity=0) self.assertTrue(os.path.exists(self.PO_FILE)) with open(self.PO_FILE) as fp: po_contents = fp.read() - # {% trans %} + # {% translate %} self.assertIn('msgctxt "Special trans context #1"', po_contents) self.assertMsgId("Translatable literal #7a", po_contents) self.assertIn('msgctxt "Special trans context #2"', po_contents) @@ -239,39 +239,39 @@ class BasicExtractorTests(ExtractorTests): self.assertIn('msgctxt "Special trans context #3"', po_contents) self.assertMsgId("Translatable literal #7c", po_contents) - # {% trans %} with a filter + # {% translate %} with a filter for minor_part in 'abcdefgh': # Iterate from #7.1a to #7.1h template markers self.assertIn('msgctxt "context #7.1{}"'.format(minor_part), po_contents) self.assertMsgId('Translatable literal #7.1{}'.format(minor_part), po_contents) - # {% blocktrans %} - self.assertIn('msgctxt "Special blocktrans context #1"', po_contents) + # {% blocktranslate %} + self.assertIn('msgctxt "Special blocktranslate context #1"', po_contents) self.assertMsgId("Translatable literal #8a", po_contents) - self.assertIn('msgctxt "Special blocktrans context #2"', po_contents) + self.assertIn('msgctxt "Special blocktranslate context #2"', po_contents) self.assertMsgId("Translatable literal #8b-singular", po_contents) self.assertIn("Translatable literal #8b-plural", po_contents) - self.assertIn('msgctxt "Special blocktrans context #3"', po_contents) + self.assertIn('msgctxt "Special blocktranslate context #3"', po_contents) self.assertMsgId("Translatable literal #8c-singular", po_contents) self.assertIn("Translatable literal #8c-plural", po_contents) - self.assertIn('msgctxt "Special blocktrans context #4"', po_contents) + self.assertIn('msgctxt "Special blocktranslate context #4"', po_contents) self.assertMsgId("Translatable literal #8d %(a)s", po_contents) - # {% translate %} and {% blocktranslate %} - self.assertMsgId('translate text', po_contents) - self.assertMsgId('blocktranslate text', po_contents) + # {% trans %} and {% blocktrans %} + self.assertMsgId('trans text', po_contents) + self.assertMsgId('blocktrans text', po_contents) def test_context_in_single_quotes(self): management.call_command('makemessages', locale=[LOCALE], verbosity=0) self.assertTrue(os.path.exists(self.PO_FILE)) with open(self.PO_FILE) as fp: po_contents = fp.read() - # {% trans %} + # {% translate %} self.assertIn('msgctxt "Context wrapped in double quotes"', po_contents) self.assertIn('msgctxt "Context wrapped in single quotes"', po_contents) - # {% blocktrans %} - self.assertIn('msgctxt "Special blocktrans context wrapped in double quotes"', po_contents) - self.assertIn('msgctxt "Special blocktrans context wrapped in single quotes"', po_contents) + # {% blocktranslate %} + self.assertIn('msgctxt "Special blocktranslate context wrapped in double quotes"', po_contents) + self.assertIn('msgctxt "Special blocktranslate context wrapped in single quotes"', po_contents) def test_template_comments(self): """Template comment tags on the same line of other constructs (#19552)""" @@ -535,8 +535,8 @@ class CopyPluralFormsExtractorTests(ExtractorTests): def test_translate_and_plural_blocktranslate_collision(self): """ Ensures a correct workaround for the gettext bug when handling a literal - found inside a {% trans %} tag and also in another file inside a - {% blocktrans %} with a plural (#17375). + found inside a {% translate %} tag and also in another file inside a + {% blocktranslate %} with a plural (#17375). """ management.call_command('makemessages', locale=[LOCALE], extensions=['html', 'djtpl'], verbosity=0) self.assertTrue(os.path.exists(self.PO_FILE)) diff --git a/tests/i18n/test_percents.py b/tests/i18n/test_percents.py index 6f36d4669a..5362ace0a7 100644 --- a/tests/i18n/test_percents.py +++ b/tests/i18n/test_percents.py @@ -61,7 +61,7 @@ class RenderingTemplatesWithPercentSigns(FrenchTestCase): """ Test rendering of templates that use percent signs. - Ensures both trans and blocktrans tags behave consistently. + Ensures both translate and blocktranslate tags behave consistently. Refs #11240, #11966, #24257 """ @@ -69,62 +69,62 @@ class RenderingTemplatesWithPercentSigns(FrenchTestCase): def test_translates_with_a_percent_symbol_at_the_end(self): expected = 'Littérale avec un symbole de pour cent à la fin %' - trans_tpl = Template('{% load i18n %}{% trans "Literal with a percent symbol at the end %" %}') + trans_tpl = Template('{% load i18n %}{% translate "Literal with a percent symbol at the end %" %}') self.assertEqual(trans_tpl.render(Context({})), expected) block_tpl = Template( - '{% load i18n %}{% blocktrans %}Literal with a percent symbol at ' - 'the end %{% endblocktrans %}' + '{% load i18n %}{% blocktranslate %}Literal with a percent symbol at ' + 'the end %{% endblocktranslate %}' ) self.assertEqual(block_tpl.render(Context({})), expected) def test_translates_with_percent_symbol_in_the_middle(self): expected = 'Pour cent littérale % avec un symbole au milieu' - trans_tpl = Template('{% load i18n %}{% trans "Literal with a percent % symbol in the middle" %}') + trans_tpl = Template('{% load i18n %}{% translate "Literal with a percent % symbol in the middle" %}') self.assertEqual(trans_tpl.render(Context({})), expected) block_tpl = Template( - '{% load i18n %}{% blocktrans %}Literal with a percent % symbol ' - 'in the middle{% endblocktrans %}' + '{% load i18n %}{% blocktranslate %}Literal with a percent % symbol ' + 'in the middle{% endblocktranslate %}' ) self.assertEqual(block_tpl.render(Context({})), expected) def test_translates_with_percent_symbol_using_context(self): - trans_tpl = Template('{% load i18n %}{% trans "It is 100%" %}') + trans_tpl = Template('{% load i18n %}{% translate "It is 100%" %}') self.assertEqual(trans_tpl.render(Context({})), 'Il est de 100%') - trans_tpl = Template('{% load i18n %}{% trans "It is 100%" context "female" %}') + trans_tpl = Template('{% load i18n %}{% translate "It is 100%" context "female" %}') self.assertEqual(trans_tpl.render(Context({})), 'Elle est de 100%') - block_tpl = Template('{% load i18n %}{% blocktrans %}It is 100%{% endblocktrans %}') + block_tpl = Template('{% load i18n %}{% blocktranslate %}It is 100%{% endblocktranslate %}') self.assertEqual(block_tpl.render(Context({})), 'Il est de 100%') - block_tpl = Template('{% load i18n %}{% blocktrans context "female" %}It is 100%{% endblocktrans %}') + block_tpl = Template('{% load i18n %}{% blocktranslate context "female" %}It is 100%{% endblocktranslate %}') self.assertEqual(block_tpl.render(Context({})), 'Elle est de 100%') def test_translates_with_string_that_look_like_fmt_spec_with_trans(self): # tests "%s" expected = ('On dirait un spec str fmt %s mais ne devrait pas être interprété comme plus disponible') trans_tpl = Template( - '{% load i18n %}{% trans "Looks like a str fmt spec %s but ' + '{% load i18n %}{% translate "Looks like a str fmt spec %s but ' 'should not be interpreted as such" %}' ) self.assertEqual(trans_tpl.render(Context({})), expected) block_tpl = Template( - '{% load i18n %}{% blocktrans %}Looks like a str fmt spec %s but ' - 'should not be interpreted as such{% endblocktrans %}' + '{% load i18n %}{% blocktranslate %}Looks like a str fmt spec %s but ' + 'should not be interpreted as such{% endblocktranslate %}' ) self.assertEqual(block_tpl.render(Context({})), expected) # tests "% o" expected = ('On dirait un spec str fmt % o mais ne devrait pas être interprété comme plus disponible') trans_tpl = Template( - '{% load i18n %}{% trans "Looks like a str fmt spec % o but should not be ' + '{% load i18n %}{% translate "Looks like a str fmt spec % o but should not be ' 'interpreted as such" %}' ) self.assertEqual(trans_tpl.render(Context({})), expected) block_tpl = Template( - '{% load i18n %}{% blocktrans %}Looks like a str fmt spec % o but should not be ' - 'interpreted as such{% endblocktrans %}' + '{% load i18n %}{% blocktranslate %}Looks like a str fmt spec % o but should not be ' + 'interpreted as such{% endblocktranslate %}' ) self.assertEqual(block_tpl.render(Context({})), expected) @@ -132,19 +132,19 @@ class RenderingTemplatesWithPercentSigns(FrenchTestCase): expected = ('1 % signe pour cent, signes %% 2 pour cent, trois signes de pourcentage %%%') trans_tpl = Template( - '{% load i18n %}{% trans "1 percent sign %, 2 percent signs %%, ' + '{% load i18n %}{% translate "1 percent sign %, 2 percent signs %%, ' '3 percent signs %%%" %}' ) self.assertEqual(trans_tpl.render(Context({})), expected) block_tpl = Template( - '{% load i18n %}{% blocktrans %}1 percent sign %, 2 percent signs ' - '%%, 3 percent signs %%%{% endblocktrans %}' + '{% load i18n %}{% blocktranslate %}1 percent sign %, 2 percent signs ' + '%%, 3 percent signs %%%{% endblocktranslate %}' ) self.assertEqual(block_tpl.render(Context({})), expected) block_tpl = Template( - '{% load i18n %}{% blocktrans %}{{name}} says: 1 percent sign %, ' - '2 percent signs %%{% endblocktrans %}' + '{% load i18n %}{% blocktranslate %}{{name}} says: 1 percent sign %, ' + '2 percent signs %%{% endblocktranslate %}' ) self.assertEqual( block_tpl.render(Context({"name": "Django"})), diff --git a/tests/template_tests/syntax_tests/i18n/test_blocktranslate.py b/tests/template_tests/syntax_tests/i18n/test_blocktranslate.py index 11bd456ea8..8edacd87e2 100644 --- a/tests/template_tests/syntax_tests/i18n/test_blocktranslate.py +++ b/tests/template_tests/syntax_tests/i18n/test_blocktranslate.py @@ -15,12 +15,12 @@ from .base import MultipleLocaleActivationTestCase, extended_locale_paths, here def setup(templates, *args, **kwargs): - blocktrans_setup = base_setup(templates, *args, **kwargs) - blocktranslate_setup = base_setup({ + blocktranslate_setup = base_setup(templates, *args, **kwargs) + blocktrans_setup = base_setup({ name: template.replace( - '{% blocktrans ', '{% blocktranslate ' + '{% blocktranslate ', '{% blocktrans ' ).replace( - '{% endblocktrans %}', '{% endblocktranslate %}' + '{% endblocktranslate %}', '{% endblocktrans %}' ) for name, template in templates.items() }) @@ -46,65 +46,65 @@ def setup(templates, *args, **kwargs): class I18nBlockTransTagTests(SimpleTestCase): libraries = {'i18n': 'django.templatetags.i18n'} - @setup({'i18n03': '{% load i18n %}{% blocktrans %}{{ anton }}{% endblocktrans %}'}) + @setup({'i18n03': '{% load i18n %}{% blocktranslate %}{{ anton }}{% endblocktranslate %}'}) def test_i18n03(self): """simple translation of a variable""" output = self.engine.render_to_string('i18n03', {'anton': 'Å'}) self.assertEqual(output, 'Å') - @setup({'i18n04': '{% load i18n %}{% blocktrans with berta=anton|lower %}{{ berta }}{% endblocktrans %}'}) + @setup({'i18n04': '{% load i18n %}{% blocktranslate with berta=anton|lower %}{{ berta }}{% endblocktranslate %}'}) def test_i18n04(self): """simple translation of a variable and filter""" output = self.engine.render_to_string('i18n04', {'anton': 'Å'}) self.assertEqual(output, 'å') @setup({'legacyi18n04': '{% load i18n %}' - '{% blocktrans with anton|lower as berta %}{{ berta }}{% endblocktrans %}'}) + '{% blocktranslate with anton|lower as berta %}{{ berta }}{% endblocktranslate %}'}) def test_legacyi18n04(self): """simple translation of a variable and filter""" output = self.engine.render_to_string('legacyi18n04', {'anton': 'Å'}) self.assertEqual(output, 'å') - @setup({'i18n05': '{% load i18n %}{% blocktrans %}xxx{{ anton }}xxx{% endblocktrans %}'}) + @setup({'i18n05': '{% load i18n %}{% blocktranslate %}xxx{{ anton }}xxx{% endblocktranslate %}'}) def test_i18n05(self): """simple translation of a string with interpolation""" output = self.engine.render_to_string('i18n05', {'anton': 'yyy'}) self.assertEqual(output, 'xxxyyyxxx') @setup({'i18n07': '{% load i18n %}' - '{% blocktrans count counter=number %}singular{% plural %}' - '{{ counter }} plural{% endblocktrans %}'}) + '{% blocktranslate count counter=number %}singular{% plural %}' + '{{ counter }} plural{% endblocktranslate %}'}) def test_i18n07(self): """translation of singular form""" output = self.engine.render_to_string('i18n07', {'number': 1}) self.assertEqual(output, 'singular') @setup({'legacyi18n07': '{% load i18n %}' - '{% blocktrans count number as counter %}singular{% plural %}' - '{{ counter }} plural{% endblocktrans %}'}) + '{% blocktranslate count number as counter %}singular{% plural %}' + '{{ counter }} plural{% endblocktranslate %}'}) def test_legacyi18n07(self): """translation of singular form""" output = self.engine.render_to_string('legacyi18n07', {'number': 1}) self.assertEqual(output, 'singular') @setup({'i18n08': '{% load i18n %}' - '{% blocktrans count number as counter %}singular{% plural %}' - '{{ counter }} plural{% endblocktrans %}'}) + '{% blocktranslate count number as counter %}singular{% plural %}' + '{{ counter }} plural{% endblocktranslate %}'}) def test_i18n08(self): """translation of plural form""" output = self.engine.render_to_string('i18n08', {'number': 2}) self.assertEqual(output, '2 plural') @setup({'legacyi18n08': '{% load i18n %}' - '{% blocktrans count counter=number %}singular{% plural %}' - '{{ counter }} plural{% endblocktrans %}'}) + '{% blocktranslate count counter=number %}singular{% plural %}' + '{{ counter }} plural{% endblocktranslate %}'}) def test_legacyi18n08(self): """translation of plural form""" output = self.engine.render_to_string('legacyi18n08', {'number': 2}) self.assertEqual(output, '2 plural') @setup({'i18n17': '{% load i18n %}' - '{% blocktrans with berta=anton|escape %}{{ berta }}{% endblocktrans %}'}) + '{% blocktranslate with berta=anton|escape %}{{ berta }}{% endblocktranslate %}'}) def test_i18n17(self): """ Escaping inside blocktranslate and translate works as if it was @@ -114,37 +114,37 @@ class I18nBlockTransTagTests(SimpleTestCase): self.assertEqual(output, 'α & β') @setup({'i18n18': '{% load i18n %}' - '{% blocktrans with berta=anton|force_escape %}{{ berta }}{% endblocktrans %}'}) + '{% blocktranslate with berta=anton|force_escape %}{{ berta }}{% endblocktranslate %}'}) def test_i18n18(self): output = self.engine.render_to_string('i18n18', {'anton': 'α & β'}) self.assertEqual(output, 'α & β') - @setup({'i18n19': '{% load i18n %}{% blocktrans %}{{ andrew }}{% endblocktrans %}'}) + @setup({'i18n19': '{% load i18n %}{% blocktranslate %}{{ andrew }}{% endblocktranslate %}'}) def test_i18n19(self): output = self.engine.render_to_string('i18n19', {'andrew': 'a & b'}) self.assertEqual(output, 'a & b') - @setup({'i18n21': '{% load i18n %}{% blocktrans %}{{ andrew }}{% endblocktrans %}'}) + @setup({'i18n21': '{% load i18n %}{% blocktranslate %}{{ andrew }}{% endblocktranslate %}'}) def test_i18n21(self): output = self.engine.render_to_string('i18n21', {'andrew': mark_safe('a & b')}) self.assertEqual(output, 'a & b') @setup({'legacyi18n17': '{% load i18n %}' - '{% blocktrans with anton|escape as berta %}{{ berta }}{% endblocktrans %}'}) + '{% blocktranslate with anton|escape as berta %}{{ berta }}{% endblocktranslate %}'}) def test_legacyi18n17(self): output = self.engine.render_to_string('legacyi18n17', {'anton': 'α & β'}) self.assertEqual(output, 'α & β') @setup({'legacyi18n18': '{% load i18n %}' - '{% blocktrans with anton|force_escape as berta %}' - '{{ berta }}{% endblocktrans %}'}) + '{% blocktranslate with anton|force_escape as berta %}' + '{{ berta }}{% endblocktranslate %}'}) def test_legacyi18n18(self): output = self.engine.render_to_string('legacyi18n18', {'anton': 'α & β'}) self.assertEqual(output, 'α & β') @setup({'i18n26': '{% load i18n %}' - '{% blocktrans with extra_field=myextra_field count counter=number %}' - 'singular {{ extra_field }}{% plural %}plural{% endblocktrans %}'}) + '{% blocktranslate with extra_field=myextra_field count counter=number %}' + 'singular {{ extra_field }}{% plural %}plural{% endblocktranslate %}'}) def test_i18n26(self): """ translation of plural form with extra field in singular form (#13568) @@ -153,15 +153,15 @@ class I18nBlockTransTagTests(SimpleTestCase): self.assertEqual(output, 'singular test') @setup({'legacyi18n26': '{% load i18n %}' - '{% blocktrans with myextra_field as extra_field count number as counter %}' - 'singular {{ extra_field }}{% plural %}plural{% endblocktrans %}'}) + '{% blocktranslate with myextra_field as extra_field count number as counter %}' + 'singular {{ extra_field }}{% plural %}plural{% endblocktranslate %}'}) def test_legacyi18n26(self): output = self.engine.render_to_string('legacyi18n26', {'myextra_field': 'test', 'number': 1}) self.assertEqual(output, 'singular test') - @setup({'i18n27': '{% load i18n %}{% blocktrans count counter=number %}' + @setup({'i18n27': '{% load i18n %}{% blocktranslate count counter=number %}' '{{ counter }} result{% plural %}{{ counter }} results' - '{% endblocktrans %}'}) + '{% endblocktranslate %}'}) def test_i18n27(self): """translation of singular form in Russian (#14126)""" with translation.override('ru'): @@ -169,30 +169,30 @@ class I18nBlockTransTagTests(SimpleTestCase): self.assertEqual(output, '1 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442') @setup({'legacyi18n27': '{% load i18n %}' - '{% blocktrans count number as counter %}{{ counter }} result' - '{% plural %}{{ counter }} results{% endblocktrans %}'}) + '{% blocktranslate count number as counter %}{{ counter }} result' + '{% plural %}{{ counter }} results{% endblocktranslate %}'}) def test_legacyi18n27(self): with translation.override('ru'): output = self.engine.render_to_string('legacyi18n27', {'number': 1}) self.assertEqual(output, '1 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442') @setup({'i18n28': '{% load i18n %}' - '{% blocktrans with a=anton b=berta %}{{ a }} + {{ b }}{% endblocktrans %}'}) + '{% blocktranslate with a=anton b=berta %}{{ a }} + {{ b }}{% endblocktranslate %}'}) def test_i18n28(self): """simple translation of multiple variables""" output = self.engine.render_to_string('i18n28', {'anton': 'α', 'berta': 'β'}) self.assertEqual(output, 'α + β') @setup({'legacyi18n28': '{% load i18n %}' - '{% blocktrans with anton as a and berta as b %}' - '{{ a }} + {{ b }}{% endblocktrans %}'}) + '{% blocktranslate with anton as a and berta as b %}' + '{{ a }} + {{ b }}{% endblocktranslate %}'}) def test_legacyi18n28(self): output = self.engine.render_to_string('legacyi18n28', {'anton': 'α', 'berta': 'β'}) self.assertEqual(output, 'α + β') - # blocktrans handling of variables which are not in the context. - # this should work as if blocktrans was not there (#19915) - @setup({'i18n34': '{% load i18n %}{% blocktrans %}{{ missing }}{% endblocktrans %}'}) + # blocktranslate handling of variables which are not in the context. + # this should work as if blocktranslate was not there (#19915) + @setup({'i18n34': '{% load i18n %}{% blocktranslate %}{{ missing }}{% endblocktranslate %}'}) def test_i18n34(self): output = self.engine.render_to_string('i18n34') if self.engine.string_if_invalid: @@ -200,7 +200,7 @@ class I18nBlockTransTagTests(SimpleTestCase): else: self.assertEqual(output, '') - @setup({'i18n34_2': '{% load i18n %}{% blocktrans with a=\'α\' %}{{ missing }}{% endblocktrans %}'}) + @setup({'i18n34_2': '{% load i18n %}{% blocktranslate with a=\'α\' %}{{ missing }}{% endblocktranslate %}'}) def test_i18n34_2(self): output = self.engine.render_to_string('i18n34_2') if self.engine.string_if_invalid: @@ -208,7 +208,7 @@ class I18nBlockTransTagTests(SimpleTestCase): else: self.assertEqual(output, '') - @setup({'i18n34_3': '{% load i18n %}{% blocktrans with a=anton %}{{ missing }}{% endblocktrans %}'}) + @setup({'i18n34_3': '{% load i18n %}{% blocktranslate with a=anton %}{{ missing }}{% endblocktranslate %}'}) def test_i18n34_3(self): output = self.engine.render_to_string( 'i18n34_3', {'anton': '\xce\xb1'}) @@ -218,16 +218,16 @@ class I18nBlockTransTagTests(SimpleTestCase): self.assertEqual(output, '') @setup({'i18n37': '{% load i18n %}' - '{% trans "Page not found" as page_not_found %}' - '{% blocktrans %}Error: {{ page_not_found }}{% endblocktrans %}'}) + '{% translate "Page not found" as page_not_found %}' + '{% blocktranslate %}Error: {{ page_not_found }}{% endblocktranslate %}'}) def test_i18n37(self): with translation.override('de'): output = self.engine.render_to_string('i18n37') self.assertEqual(output, 'Error: Seite nicht gefunden') - # blocktrans tag with asvar + # blocktranslate tag with asvar @setup({'i18n39': '{% load i18n %}' - '{% blocktrans asvar page_not_found %}Page not found{% endblocktrans %}' + '{% blocktranslate asvar page_not_found %}Page not found{% endblocktranslate %}' '>{{ page_not_found }}<'}) def test_i18n39(self): with translation.override('de'): @@ -235,69 +235,73 @@ class I18nBlockTransTagTests(SimpleTestCase): self.assertEqual(output, '>Seite nicht gefunden<') @setup({'i18n40': '{% load i18n %}' - '{% trans "Page not found" as pg_404 %}' - '{% blocktrans with page_not_found=pg_404 asvar output %}' + '{% translate "Page not found" as pg_404 %}' + '{% blocktranslate with page_not_found=pg_404 asvar output %}' 'Error: {{ page_not_found }}' - '{% endblocktrans %}'}) + '{% endblocktranslate %}'}) def test_i18n40(self): output = self.engine.render_to_string('i18n40') self.assertEqual(output, '') @setup({'i18n41': '{% load i18n %}' - '{% trans "Page not found" as pg_404 %}' - '{% blocktrans with page_not_found=pg_404 asvar output %}' + '{% translate "Page not found" as pg_404 %}' + '{% blocktranslate with page_not_found=pg_404 asvar output %}' 'Error: {{ page_not_found }}' - '{% endblocktrans %}' + '{% endblocktranslate %}' '>{{ output }}<'}) def test_i18n41(self): with translation.override('de'): output = self.engine.render_to_string('i18n41') self.assertEqual(output, '>Error: Seite nicht gefunden<') - @setup({'template': '{% load i18n %}{% blocktrans asvar %}Yes{% endblocktrans %}'}) + @setup({'template': '{% load i18n %}{% blocktranslate asvar %}Yes{% endblocktranslate %}'}) def test_blocktrans_syntax_error_missing_assignment(self, tag_name): msg = "No argument provided to the '{}' tag for the asvar option.".format(tag_name) with self.assertRaisesMessage(TemplateSyntaxError, msg): self.engine.render_to_string('template') - @setup({'template': '{% load i18n %}{% blocktrans %}%s{% endblocktrans %}'}) + @setup({'template': '{% load i18n %}{% blocktranslate %}%s{% endblocktranslate %}'}) def test_blocktrans_tag_using_a_string_that_looks_like_str_fmt(self): output = self.engine.render_to_string('template') self.assertEqual(output, '%s') - @setup({'template': '{% load i18n %}{% blocktrans %}{% block b %} {% endblock %}{% endblocktrans %}'}) + @setup({'template': '{% load i18n %}{% blocktranslate %}{% block b %} {% endblock %}{% endblocktranslate %}'}) def test_with_block(self, tag_name): msg = "'{}' doesn't allow other block tags (seen 'block b') inside it".format(tag_name) with self.assertRaisesMessage(TemplateSyntaxError, msg): self.engine.render_to_string('template') - @setup({'template': '{% load i18n %}{% blocktrans %}{% for b in [1, 2, 3] %} {% endfor %}{% endblocktrans %}'}) + @setup({'template': ( + '{% load i18n %}' + '{% blocktranslate %}{% for b in [1, 2, 3] %} {% endfor %}' + '{% endblocktranslate %}' + )}) def test_with_for(self, tag_name): msg = "'{}' doesn't allow other block tags (seen 'for b in [1, 2, 3]') inside it".format(tag_name) with self.assertRaisesMessage(TemplateSyntaxError, msg): self.engine.render_to_string('template') - @setup({'template': '{% load i18n %}{% blocktrans with foo=bar with %}{{ foo }}{% endblocktrans %}'}) + @setup({'template': '{% load i18n %}{% blocktranslate with foo=bar with %}{{ foo }}{% endblocktranslate %}'}) def test_variable_twice(self): with self.assertRaisesMessage(TemplateSyntaxError, "The 'with' option was specified more than once"): self.engine.render_to_string('template', {'foo': 'bar'}) - @setup({'template': '{% load i18n %}{% blocktrans with %}{% endblocktrans %}'}) + @setup({'template': '{% load i18n %}{% blocktranslate with %}{% endblocktranslate %}'}) def test_no_args_with(self, tag_name): msg = '"with" in \'{}\' tag needs at least one keyword argument.'.format(tag_name) with self.assertRaisesMessage(TemplateSyntaxError, msg): self.engine.render_to_string('template') - @setup({'template': '{% load i18n %}{% blocktrans count a %}{% endblocktrans %}'}) + @setup({'template': '{% load i18n %}{% blocktranslate count a %}{% endblocktranslate %}'}) def test_count(self, tag_name): msg = '"count" in \'{}\' tag expected exactly one keyword argument.'.format(tag_name) with self.assertRaisesMessage(TemplateSyntaxError, msg): self.engine.render_to_string('template', {'a': [1, 2, 3]}) @setup({'template': ( - '{% load i18n %}{% blocktrans count count=var|length %}' + '{% load i18n %}{% blocktranslate count count=var|length %}' 'There is {{ count }} object. {% block a %} {% endblock %}' - '{% endblocktrans %}' + '{% endblocktranslate %}' )}) def test_plural_bad_syntax(self, tag_name): msg = "'{}' doesn't allow other block tags inside it".format(tag_name) @@ -305,133 +309,142 @@ class I18nBlockTransTagTests(SimpleTestCase): self.engine.render_to_string('template', {'var': [1, 2, 3]}) -class TranslationBlockTransTagTests(SimpleTestCase): - tag_name = 'blocktrans' +class TranslationBlockTranslateTagTests(SimpleTestCase): + tag_name = 'blocktranslate' def get_template(self, template_string): return Template( template_string.replace( - '{{% blocktrans ', + '{{% blocktranslate ', '{{% {}'.format(self.tag_name) ).replace( - '{{% endblocktrans %}}', + '{{% endblocktranslate %}}', '{{% end{} %}}'.format(self.tag_name) ) ) @override_settings(LOCALE_PATHS=extended_locale_paths) def test_template_tags_pgettext(self): - """{% blocktrans %} takes message contexts into account (#14806).""" + """{% blocktranslate %} takes message contexts into account (#14806).""" trans_real._active = Local() trans_real._translations = {} with translation.override('de'): # Nonexistent context - t = self.get_template('{% load i18n %}{% blocktrans context "nonexistent" %}May{% endblocktrans %}') + t = self.get_template( + '{% load i18n %}{% blocktranslate context "nonexistent" %}May' + '{% endblocktranslate %}' + ) rendered = t.render(Context()) self.assertEqual(rendered, 'May') # Existing context... using a literal - t = self.get_template('{% load i18n %}{% blocktrans context "month name" %}May{% endblocktrans %}') + t = self.get_template('{% load i18n %}{% blocktranslate context "month name" %}May{% endblocktranslate %}') rendered = t.render(Context()) self.assertEqual(rendered, 'Mai') - t = self.get_template('{% load i18n %}{% blocktrans context "verb" %}May{% endblocktrans %}') + t = self.get_template('{% load i18n %}{% blocktranslate context "verb" %}May{% endblocktranslate %}') rendered = t.render(Context()) self.assertEqual(rendered, 'Kann') # Using a variable - t = self.get_template('{% load i18n %}{% blocktrans context message_context %}May{% endblocktrans %}') + t = self.get_template( + '{% load i18n %}{% blocktranslate context message_context %}' + 'May{% endblocktranslate %}' + ) rendered = t.render(Context({'message_context': 'month name'})) self.assertEqual(rendered, 'Mai') - t = self.get_template('{% load i18n %}{% blocktrans context message_context %}May{% endblocktrans %}') + t = self.get_template( + '{% load i18n %}{% blocktranslate context message_context %}' + 'May{% endblocktranslate %}' + ) rendered = t.render(Context({'message_context': 'verb'})) self.assertEqual(rendered, 'Kann') # Using a filter t = self.get_template( - '{% load i18n %}{% blocktrans context message_context|lower %}May{% endblocktrans %}' + '{% load i18n %}{% blocktranslate context message_context|lower %}May{% endblocktranslate %}' ) rendered = t.render(Context({'message_context': 'MONTH NAME'})) self.assertEqual(rendered, 'Mai') t = self.get_template( - '{% load i18n %}{% blocktrans context message_context|lower %}May{% endblocktrans %}' + '{% load i18n %}{% blocktranslate context message_context|lower %}May{% endblocktranslate %}' ) rendered = t.render(Context({'message_context': 'VERB'})) self.assertEqual(rendered, 'Kann') # Using 'count' t = self.get_template( - '{% load i18n %}{% blocktrans count number=1 context "super search" %}' - '{{ number }} super result{% plural %}{{ number }} super results{% endblocktrans %}' + '{% load i18n %}{% blocktranslate count number=1 context "super search" %}' + '{{ number }} super result{% plural %}{{ number }} super results{% endblocktranslate %}' ) rendered = t.render(Context()) self.assertEqual(rendered, '1 Super-Ergebnis') t = self.get_template( - '{% load i18n %}{% blocktrans count number=2 context "super search" %}{{ number }}' - ' super result{% plural %}{{ number }} super results{% endblocktrans %}' + '{% load i18n %}{% blocktranslate count number=2 context "super search" %}{{ number }}' + ' super result{% plural %}{{ number }} super results{% endblocktranslate %}' ) rendered = t.render(Context()) self.assertEqual(rendered, '2 Super-Ergebnisse') t = self.get_template( - '{% load i18n %}{% blocktrans context "other super search" count number=1 %}' - '{{ number }} super result{% plural %}{{ number }} super results{% endblocktrans %}' + '{% load i18n %}{% blocktranslate context "other super search" count number=1 %}' + '{{ number }} super result{% plural %}{{ number }} super results{% endblocktranslate %}' ) rendered = t.render(Context()) self.assertEqual(rendered, '1 anderen Super-Ergebnis') t = self.get_template( - '{% load i18n %}{% blocktrans context "other super search" count number=2 %}' - '{{ number }} super result{% plural %}{{ number }} super results{% endblocktrans %}' + '{% load i18n %}{% blocktranslate context "other super search" count number=2 %}' + '{{ number }} super result{% plural %}{{ number }} super results{% endblocktranslate %}' ) rendered = t.render(Context()) self.assertEqual(rendered, '2 andere Super-Ergebnisse') # Using 'with' t = self.get_template( - '{% load i18n %}{% blocktrans with num_comments=5 context "comment count" %}' - 'There are {{ num_comments }} comments{% endblocktrans %}' + '{% load i18n %}{% blocktranslate with num_comments=5 context "comment count" %}' + 'There are {{ num_comments }} comments{% endblocktranslate %}' ) rendered = t.render(Context()) self.assertEqual(rendered, 'Es gibt 5 Kommentare') t = self.get_template( - '{% load i18n %}{% blocktrans with num_comments=5 context "other comment count" %}' - 'There are {{ num_comments }} comments{% endblocktrans %}' + '{% load i18n %}{% blocktranslate with num_comments=5 context "other comment count" %}' + 'There are {{ num_comments }} comments{% endblocktranslate %}' ) rendered = t.render(Context()) self.assertEqual(rendered, 'Andere: Es gibt 5 Kommentare') # Using trimmed t = self.get_template( - '{% load i18n %}{% blocktrans trimmed %}\n\nThere\n\t are 5 ' - '\n\n comments\n{% endblocktrans %}' + '{% load i18n %}{% blocktranslate trimmed %}\n\nThere\n\t are 5 ' + '\n\n comments\n{% endblocktranslate %}' ) rendered = t.render(Context()) self.assertEqual(rendered, 'There are 5 comments') t = self.get_template( - '{% load i18n %}{% blocktrans with num_comments=5 context "comment count" trimmed %}\n\n' - 'There are \t\n \t {{ num_comments }} comments\n\n{% endblocktrans %}' + '{% load i18n %}{% blocktranslate with num_comments=5 context "comment count" trimmed %}\n\n' + 'There are \t\n \t {{ num_comments }} comments\n\n{% endblocktranslate %}' ) rendered = t.render(Context()) self.assertEqual(rendered, 'Es gibt 5 Kommentare') t = self.get_template( - '{% load i18n %}{% blocktrans context "other super search" count number=2 trimmed %}\n' - '{{ number }} super \n result{% plural %}{{ number }} super results{% endblocktrans %}' + '{% load i18n %}{% blocktranslate context "other super search" count number=2 trimmed %}\n' + '{{ number }} super \n result{% plural %}{{ number }} super results{% endblocktranslate %}' ) rendered = t.render(Context()) self.assertEqual(rendered, '2 andere Super-Ergebnisse') # Misuses - msg = "Unknown argument for 'blocktrans' tag: %r." + msg = "Unknown argument for 'blocktranslate' tag: %r." with self.assertRaisesMessage(TemplateSyntaxError, msg % 'month="May"'): self.get_template( - '{% load i18n %}{% blocktrans context with month="May" %}{{ month }}{% endblocktrans %}' + '{% load i18n %}{% blocktranslate context with month="May" %}{{ month }}{% endblocktranslate %}' ) - msg = '"context" in %r tag expected exactly one argument.' % 'blocktrans' + msg = '"context" in %r tag expected exactly one argument.' % 'blocktranslate' with self.assertRaisesMessage(TemplateSyntaxError, msg): - self.get_template('{% load i18n %}{% blocktrans context %}{% endblocktrans %}') + self.get_template('{% load i18n %}{% blocktranslate context %}{% endblocktranslate %}') with self.assertRaisesMessage(TemplateSyntaxError, msg): self.get_template( - '{% load i18n %}{% blocktrans count number=2 context %}' + '{% load i18n %}{% blocktranslate count number=2 context %}' '{{ number }} super result{% plural %}{{ number }}' - ' super results{% endblocktrans %}' + ' super results{% endblocktranslate %}' ) @override_settings(LOCALE_PATHS=[os.path.join(here, 'other', 'locale')]) @@ -441,7 +454,7 @@ class TranslationBlockTransTagTests(SimpleTestCase): (%(person)s is translated as %(personne)s in fr.po). """ with translation.override('fr'): - t = Template('{% load i18n %}{% blocktrans %}My name is {{ person }}.{% endblocktrans %}') + t = Template('{% load i18n %}{% blocktranslate %}My name is {{ person }}.{% endblocktranslate %}') rendered = t.render(Context({'person': 'James'})) self.assertEqual(rendered, 'My name is James.') @@ -453,25 +466,25 @@ class TranslationBlockTransTagTests(SimpleTestCase): . """ with translation.override('fr'): - t = Template('{% load i18n %}{% blocktrans %}My other name is {{ person }}.{% endblocktrans %}') + t = Template('{% load i18n %}{% blocktranslate %}My other name is {{ person }}.{% endblocktranslate %}') rendered = t.render(Context({'person': 'James'})) self.assertEqual(rendered, 'My other name is James.') -class TranslationBlockTranslationTagTests(TranslationBlockTransTagTests): - tag_name = 'blocktranslation' - - -class MultipleLocaleActivationBlockTransTests(MultipleLocaleActivationTestCase): +class TranslationBlockTransnTagTests(TranslationBlockTranslateTagTests): tag_name = 'blocktrans' + +class MultipleLocaleActivationBlockTranslateTests(MultipleLocaleActivationTestCase): + tag_name = 'blocktranslate' + def get_template(self, template_string): return Template( template_string.replace( - '{{% blocktrans ', + '{{% blocktranslate ', '{{% {}'.format(self.tag_name) ).replace( - '{{% endblocktrans %}}', + '{{% endblocktranslate %}}', '{{% end{} %}}'.format(self.tag_name) ) ) @@ -483,31 +496,31 @@ class MultipleLocaleActivationBlockTransTests(MultipleLocaleActivationTestCase): """ with translation.override('fr'): self.assertEqual( - self.get_template("{% load i18n %}{% blocktrans %}Yes{% endblocktrans %}").render(Context({})), + self.get_template("{% load i18n %}{% blocktranslate %}Yes{% endblocktranslate %}").render(Context({})), 'Oui' ) def test_multiple_locale_btrans(self): with translation.override('de'): - t = self.get_template("{% load i18n %}{% blocktrans %}No{% endblocktrans %}") + t = self.get_template("{% load i18n %}{% blocktranslate %}No{% endblocktranslate %}") with translation.override(self._old_language), translation.override('nl'): self.assertEqual(t.render(Context({})), 'Nee') def test_multiple_locale_deactivate_btrans(self): with translation.override('de', deactivate=True): - t = self.get_template("{% load i18n %}{% blocktrans %}No{% endblocktrans %}") + t = self.get_template("{% load i18n %}{% blocktranslate %}No{% endblocktranslate %}") with translation.override('nl'): self.assertEqual(t.render(Context({})), 'Nee') def test_multiple_locale_direct_switch_btrans(self): with translation.override('de'): - t = self.get_template("{% load i18n %}{% blocktrans %}No{% endblocktrans %}") + t = self.get_template("{% load i18n %}{% blocktranslate %}No{% endblocktranslate %}") with translation.override('nl'): self.assertEqual(t.render(Context({})), 'Nee') -class MultipleLocaleActivationBlockTranslationTests(MultipleLocaleActivationBlockTransTests): - tag_name = 'blocktranslation' +class MultipleLocaleActivationBlockTransTests(MultipleLocaleActivationBlockTranslateTests): + tag_name = 'blocktrans' class MiscTests(SimpleTestCase): @@ -516,21 +529,23 @@ class MiscTests(SimpleTestCase): def get_template(self, template_string): return Template( template_string.replace( - '{{% blocktrans ', + '{{% blocktranslate ', '{{% {}'.format(self.tag_name) ).replace( - '{{% endblocktrans %}}', + '{{% endblocktranslate %}}', '{{% end{} %}}'.format(self.tag_name) ) ) @override_settings(LOCALE_PATHS=extended_locale_paths) def test_percent_in_translatable_block(self): - t_sing = self.get_template("{% load i18n %}{% blocktrans %}The result was {{ percent }}%{% endblocktrans %}") + t_sing = self.get_template( + "{% load i18n %}{% blocktranslate %}The result was {{ percent }}%{% endblocktranslate %}" + ) t_plur = self.get_template( - "{% load i18n %}{% blocktrans count num as number %}" + "{% load i18n %}{% blocktranslate count num as number %}" "{{ percent }}% represents {{ num }} object{% plural %}" - "{{ percent }}% represents {{ num }} objects{% endblocktrans %}" + "{{ percent }}% represents {{ num }} objects{% endblocktranslate %}" ) with translation.override('de'): self.assertEqual(t_sing.render(Context({'percent': 42})), 'Das Ergebnis war 42%') @@ -544,12 +559,12 @@ class MiscTests(SimpleTestCase): or plural. """ t_sing = self.get_template( - "{% load i18n %}{% blocktrans %}There are %(num_comments)s comments{% endblocktrans %}" + "{% load i18n %}{% blocktranslate %}There are %(num_comments)s comments{% endblocktranslate %}" ) t_plur = self.get_template( - "{% load i18n %}{% blocktrans count num as number %}" + "{% load i18n %}{% blocktranslate count num as number %}" "%(percent)s% represents {{ num }} object{% plural %}" - "%(percent)s% represents {{ num }} objects{% endblocktrans %}" + "%(percent)s% represents {{ num }} objects{% endblocktranslate %}" ) with translation.override('de'): # Strings won't get translated as they don't match after escaping % diff --git a/tests/template_tests/syntax_tests/i18n/test_translate.py b/tests/template_tests/syntax_tests/i18n/test_translate.py index 6011153a2d..55fdb92f7a 100644 --- a/tests/template_tests/syntax_tests/i18n/test_translate.py +++ b/tests/template_tests/syntax_tests/i18n/test_translate.py @@ -15,9 +15,9 @@ from .base import MultipleLocaleActivationTestCase, extended_locale_paths def setup(templates, *args, **kwargs): - trans_setup = base_setup(templates, *args, **kwargs) - translate_setup = base_setup({ - name: template.replace('{% trans ', '{% translate ') + translate_setup = base_setup(templates, *args, **kwargs) + trans_setup = base_setup({ + name: template.replace('{% translate ', '{% trans ') for name, template in templates.items() }) @@ -42,118 +42,118 @@ def setup(templates, *args, **kwargs): class I18nTransTagTests(SimpleTestCase): libraries = {'i18n': 'django.templatetags.i18n'} - @setup({'i18n01': '{% load i18n %}{% trans \'xxxyyyxxx\' %}'}) + @setup({'i18n01': '{% load i18n %}{% translate \'xxxyyyxxx\' %}'}) def test_i18n01(self): """simple translation of a string delimited by '.""" output = self.engine.render_to_string('i18n01') self.assertEqual(output, 'xxxyyyxxx') - @setup({'i18n02': '{% load i18n %}{% trans "xxxyyyxxx" %}'}) + @setup({'i18n02': '{% load i18n %}{% translate "xxxyyyxxx" %}'}) def test_i18n02(self): """simple translation of a string delimited by ".""" output = self.engine.render_to_string('i18n02') self.assertEqual(output, 'xxxyyyxxx') - @setup({'i18n06': '{% load i18n %}{% trans "Page not found" %}'}) + @setup({'i18n06': '{% load i18n %}{% translate "Page not found" %}'}) def test_i18n06(self): """simple translation of a string to German""" with translation.override('de'): output = self.engine.render_to_string('i18n06') self.assertEqual(output, 'Seite nicht gefunden') - @setup({'i18n09': '{% load i18n %}{% trans "Page not found" noop %}'}) + @setup({'i18n09': '{% load i18n %}{% translate "Page not found" noop %}'}) def test_i18n09(self): """simple non-translation (only marking) of a string to German""" with translation.override('de'): output = self.engine.render_to_string('i18n09') self.assertEqual(output, 'Page not found') - @setup({'i18n20': '{% load i18n %}{% trans andrew %}'}) + @setup({'i18n20': '{% load i18n %}{% translate andrew %}'}) def test_i18n20(self): output = self.engine.render_to_string('i18n20', {'andrew': 'a & b'}) self.assertEqual(output, 'a & b') - @setup({'i18n22': '{% load i18n %}{% trans andrew %}'}) + @setup({'i18n22': '{% load i18n %}{% translate andrew %}'}) def test_i18n22(self): output = self.engine.render_to_string('i18n22', {'andrew': mark_safe('a & b')}) self.assertEqual(output, 'a & b') - @setup({'i18n23': '{% load i18n %}{% trans "Page not found"|capfirst|slice:"6:" %}'}) + @setup({'i18n23': '{% load i18n %}{% translate "Page not found"|capfirst|slice:"6:" %}'}) def test_i18n23(self): - """Using filters with the {% trans %} tag (#5972).""" + """Using filters with the {% translate %} tag (#5972).""" with translation.override('de'): output = self.engine.render_to_string('i18n23') self.assertEqual(output, 'nicht gefunden') - @setup({'i18n24': '{% load i18n %}{% trans \'Page not found\'|upper %}'}) + @setup({'i18n24': '{% load i18n %}{% translate \'Page not found\'|upper %}'}) def test_i18n24(self): with translation.override('de'): output = self.engine.render_to_string('i18n24') self.assertEqual(output, 'SEITE NICHT GEFUNDEN') - @setup({'i18n25': '{% load i18n %}{% trans somevar|upper %}'}) + @setup({'i18n25': '{% load i18n %}{% translate somevar|upper %}'}) def test_i18n25(self): with translation.override('de'): output = self.engine.render_to_string('i18n25', {'somevar': 'Page not found'}) self.assertEqual(output, 'SEITE NICHT GEFUNDEN') # trans tag with as var - @setup({'i18n35': '{% load i18n %}{% trans "Page not found" as page_not_found %}{{ page_not_found }}'}) + @setup({'i18n35': '{% load i18n %}{% translate "Page not found" as page_not_found %}{{ page_not_found }}'}) def test_i18n35(self): with translation.override('de'): output = self.engine.render_to_string('i18n35') self.assertEqual(output, 'Seite nicht gefunden') @setup({'i18n36': '{% load i18n %}' - '{% trans "Page not found" noop as page_not_found %}{{ page_not_found }}'}) + '{% translate "Page not found" noop as page_not_found %}{{ page_not_found }}'}) def test_i18n36(self): with translation.override('de'): output = self.engine.render_to_string('i18n36') self.assertEqual(output, 'Page not found') - @setup({'template': '{% load i18n %}{% trans %}A}'}) + @setup({'template': '{% load i18n %}{% translate %}A}'}) def test_syntax_error_no_arguments(self, tag_name): msg = "'{}' takes at least one argument".format(tag_name) with self.assertRaisesMessage(TemplateSyntaxError, msg): self.engine.render_to_string('template') - @setup({'template': '{% load i18n %}{% trans "Yes" badoption %}'}) + @setup({'template': '{% load i18n %}{% translate "Yes" badoption %}'}) def test_syntax_error_bad_option(self, tag_name): msg = "Unknown argument for '{}' tag: 'badoption'".format(tag_name) with self.assertRaisesMessage(TemplateSyntaxError, msg): self.engine.render_to_string('template') - @setup({'template': '{% load i18n %}{% trans "Yes" as %}'}) + @setup({'template': '{% load i18n %}{% translate "Yes" as %}'}) def test_syntax_error_missing_assignment(self, tag_name): msg = "No argument provided to the '{}' tag for the as option.".format(tag_name) with self.assertRaisesMessage(TemplateSyntaxError, msg): self.engine.render_to_string('template') - @setup({'template': '{% load i18n %}{% trans "Yes" as var context %}'}) + @setup({'template': '{% load i18n %}{% translate "Yes" as var context %}'}) def test_syntax_error_missing_context(self, tag_name): msg = "No argument provided to the '{}' tag for the context option.".format(tag_name) with self.assertRaisesMessage(TemplateSyntaxError, msg): self.engine.render_to_string('template') - @setup({'template': '{% load i18n %}{% trans "Yes" context as var %}'}) + @setup({'template': '{% load i18n %}{% translate "Yes" context as var %}'}) def test_syntax_error_context_as(self, tag_name): msg = "Invalid argument 'as' provided to the '{}' tag for the context option".format(tag_name) with self.assertRaisesMessage(TemplateSyntaxError, msg): self.engine.render_to_string('template') - @setup({'template': '{% load i18n %}{% trans "Yes" context noop %}'}) + @setup({'template': '{% load i18n %}{% translate "Yes" context noop %}'}) def test_syntax_error_context_noop(self, tag_name): msg = "Invalid argument 'noop' provided to the '{}' tag for the context option".format(tag_name) with self.assertRaisesMessage(TemplateSyntaxError, msg): self.engine.render_to_string('template') - @setup({'template': '{% load i18n %}{% trans "Yes" noop noop %}'}) + @setup({'template': '{% load i18n %}{% translate "Yes" noop noop %}'}) def test_syntax_error_duplicate_option(self): msg = "The 'noop' option was specified more than once." with self.assertRaisesMessage(TemplateSyntaxError, msg): self.engine.render_to_string('template') - @setup({'template': '{% load i18n %}{% trans "%s" %}'}) + @setup({'template': '{% load i18n %}{% translate "%s" %}'}) def test_trans_tag_using_a_string_that_looks_like_str_fmt(self): output = self.engine.render_to_string('template') self.assertEqual(output, '%s') @@ -165,51 +165,51 @@ class TranslationTransTagTests(SimpleTestCase): def get_template(self, template_string): return Template( template_string.replace( - '{{% trans ', + '{{% translate ', '{{% {}'.format(self.tag_name) ) ) @override_settings(LOCALE_PATHS=extended_locale_paths) def test_template_tags_pgettext(self): - """{% trans %} takes message contexts into account (#14806).""" + """{% translate %} takes message contexts into account (#14806).""" trans_real._active = Local() trans_real._translations = {} with translation.override('de'): # Nonexistent context... - t = self.get_template('{% load i18n %}{% trans "May" context "nonexistent" %}') + t = self.get_template('{% load i18n %}{% translate "May" context "nonexistent" %}') rendered = t.render(Context()) self.assertEqual(rendered, 'May') # Existing context... using a literal - t = self.get_template('{% load i18n %}{% trans "May" context "month name" %}') + t = self.get_template('{% load i18n %}{% translate "May" context "month name" %}') rendered = t.render(Context()) self.assertEqual(rendered, 'Mai') - t = self.get_template('{% load i18n %}{% trans "May" context "verb" %}') + t = self.get_template('{% load i18n %}{% translate "May" context "verb" %}') rendered = t.render(Context()) self.assertEqual(rendered, 'Kann') # Using a variable - t = self.get_template('{% load i18n %}{% trans "May" context message_context %}') + t = self.get_template('{% load i18n %}{% translate "May" context message_context %}') rendered = t.render(Context({'message_context': 'month name'})) self.assertEqual(rendered, 'Mai') - t = self.get_template('{% load i18n %}{% trans "May" context message_context %}') + t = self.get_template('{% load i18n %}{% translate "May" context message_context %}') rendered = t.render(Context({'message_context': 'verb'})) self.assertEqual(rendered, 'Kann') # Using a filter - t = self.get_template('{% load i18n %}{% trans "May" context message_context|lower %}') + t = self.get_template('{% load i18n %}{% translate "May" context message_context|lower %}') rendered = t.render(Context({'message_context': 'MONTH NAME'})) self.assertEqual(rendered, 'Mai') - t = self.get_template('{% load i18n %}{% trans "May" context message_context|lower %}') + t = self.get_template('{% load i18n %}{% translate "May" context message_context|lower %}') rendered = t.render(Context({'message_context': 'VERB'})) self.assertEqual(rendered, 'Kann') # Using 'as' - t = self.get_template('{% load i18n %}{% trans "May" context "month name" as var %}Value: {{ var }}') + t = self.get_template('{% load i18n %}{% translate "May" context "month name" as var %}Value: {{ var }}') rendered = t.render(Context()) self.assertEqual(rendered, 'Value: Mai') - t = self.get_template('{% load i18n %}{% trans "May" as var context "verb" %}Value: {{ var }}') + t = self.get_template('{% load i18n %}{% translate "May" as var context "verb" %}Value: {{ var }}') rendered = t.render(Context()) self.assertEqual(rendered, 'Value: Kann') @@ -224,7 +224,7 @@ class MultipleLocaleActivationTransTagTests(MultipleLocaleActivationTestCase): def get_template(self, template_string): return Template( template_string.replace( - '{{% trans ', + '{{% translate ', '{{% {}'.format(self.tag_name) ) ) @@ -236,25 +236,25 @@ class MultipleLocaleActivationTransTagTests(MultipleLocaleActivationTestCase): """ with translation.override('fr'): self.assertEqual( - self.get_template("{% load i18n %}{% trans 'Yes' %}").render(Context({})), + self.get_template("{% load i18n %}{% translate 'Yes' %}").render(Context({})), 'Oui' ) def test_multiple_locale_trans(self): with translation.override('de'): - t = self.get_template("{% load i18n %}{% trans 'No' %}") + t = self.get_template("{% load i18n %}{% translate 'No' %}") with translation.override(self._old_language), translation.override('nl'): self.assertEqual(t.render(Context({})), 'Nee') def test_multiple_locale_deactivate_trans(self): with translation.override('de', deactivate=True): - t = self.get_template("{% load i18n %}{% trans 'No' %}") + t = self.get_template("{% load i18n %}{% translate 'No' %}") with translation.override('nl'): self.assertEqual(t.render(Context({})), 'Nee') def test_multiple_locale_direct_switch_trans(self): with translation.override('de'): - t = self.get_template("{% load i18n %}{% trans 'No' %}") + t = self.get_template("{% load i18n %}{% translate 'No' %}") with translation.override('nl'): self.assertEqual(t.render(Context({})), 'Nee') diff --git a/tests/template_tests/syntax_tests/test_invalid_string.py b/tests/template_tests/syntax_tests/test_invalid_string.py index 18520aa7bf..b05abcfdf3 100644 --- a/tests/template_tests/syntax_tests/test_invalid_string.py +++ b/tests/template_tests/syntax_tests/test_invalid_string.py @@ -53,7 +53,7 @@ class InvalidStringTests(SimpleTestCase): else: self.assertEqual(output, '') - @setup({'invalidstr07': '{% load i18n %}{% blocktrans %}{{ var }}{% endblocktrans %}'}) + @setup({'invalidstr07': '{% load i18n %}{% blocktranslate %}{{ var }}{% endblocktranslate %}'}) def test_invalidstr07(self): output = self.engine.render_to_string('invalidstr07') if self.engine.string_if_invalid: