diff --git a/docs/development/internationalization.md b/docs/development/internationalization.md index bdc7cbdaa..bebc97470 100644 --- a/docs/development/internationalization.md +++ b/docs/development/internationalization.md @@ -97,7 +97,7 @@ class CircuitTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable): 1. Ensure translation support is enabled by including `{% load i18n %}` at the top of the template. 2. Use the [`{% trans %}`](https://docs.djangoproject.com/en/stable/topics/i18n/translation/#translate-template-tag) tag (short for "translate") to wrap short strings. -3. Longer strings may be enclosed between [`{% blocktrans %}`](https://docs.djangoproject.com/en/stable/topics/i18n/translation/#blocktranslate-template-tag) and `{% endblocktrans %}` tags to improve readability and to enable variable replacement. +3. Longer strings may be enclosed between [`{% blocktrans %}`](https://docs.djangoproject.com/en/stable/topics/i18n/translation/#blocktranslate-template-tag) and `{% endblocktrans %}` tags to improve readability and to enable variable replacement. (Remember to include the `trimmed` argument to trim whitespace between the tags.) 4. Avoid passing HTML within translated strings where possible, as this can complicate the work needed of human translators to develop message maps. ``` @@ -107,7 +107,7 @@ class CircuitTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
{% blocktrans %}Swap these terminations for circuit {{ circuit }}?{% endblocktrans %}
++ {% blocktrans trimmed %} + Swap these terminations for circuit {{ circuit }}? + {% endblocktrans %} +
- {% blocktrans with count=selected_objects|length %} + {% blocktrans trimmed with count=selected_objects|length %} Are you sure you want to disconnect these {{ count }} {{ obj_type_plural }}? {% endblocktrans %}
diff --git a/netbox/templates/dcim/cable_trace.html b/netbox/templates/dcim/cable_trace.html index f955c9cf8..676f8a3e5 100644 --- a/netbox/templates/dcim/cable_trace.html +++ b/netbox/templates/dcim/cable_trace.html @@ -3,7 +3,7 @@ {% load i18n %} {% block title %} - {% blocktrans with object_type=object|meta:"verbose_name"|bettertitle %} + {% blocktrans trimmed with object_type=object|meta:"verbose_name"|bettertitle %} Cable Trace for {{ object_type }} {{ object }} {% endblocktrans %} {% endblock %} diff --git a/netbox/templates/dcim/devicebay_delete.html b/netbox/templates/dcim/devicebay_delete.html index 47e2ba545..18f4f6576 100644 --- a/netbox/templates/dcim/devicebay_delete.html +++ b/netbox/templates/dcim/devicebay_delete.html @@ -2,8 +2,14 @@ {% load form_helpers %} {% load i18n %} -{% block title %}{% blocktrans %}Delete device bay {{ devicebay }}?{% endblocktrans %}{% endblock %} +{% block title %} + {% blocktrans %}Delete device bay {{ devicebay }}?{% endblocktrans %} +{% endblock %} {% block message %} -{% blocktrans %}Are you sure you want to delete this device bay from {{ devicebay.device }}?{% endblocktrans %}
++ {% blocktrans trimmed %} + Are you sure you want to delete this device bay from {{ devicebay.device }}? + {% endblocktrans %} +
{% endblock %} diff --git a/netbox/templates/dcim/devicebay_depopulate.html b/netbox/templates/dcim/devicebay_depopulate.html index a0c026800..b094f5993 100644 --- a/netbox/templates/dcim/devicebay_depopulate.html +++ b/netbox/templates/dcim/devicebay_depopulate.html @@ -3,14 +3,14 @@ {% load i18n %} {% block title %} - {% blocktrans with device=device_bay.installed_device %} + {% blocktrans trimmed with device=device_bay.installed_device %} Remove {{ device }} from {{ device_bay }}? {% endblocktrans %} {% endblock %} {% block message %}- {% blocktrans with device=device_bay.installed_device %} + {% blocktrans trimmed with device=device_bay.installed_device %} Are you sure you want to remove {{ device }} from {{ device_bay }}? {% endblocktrans %}
diff --git a/netbox/templates/dcim/devicetype/component_templates.html b/netbox/templates/dcim/devicetype/component_templates.html index a2dcb6c0e..9a5210762 100644 --- a/netbox/templates/dcim/devicetype/component_templates.html +++ b/netbox/templates/dcim/devicetype/component_templates.html @@ -27,7 +27,7 @@ diff --git a/netbox/templates/dcim/moduletype/component_templates.html b/netbox/templates/dcim/moduletype/component_templates.html index 63cc1bb99..bb54a33f9 100644 --- a/netbox/templates/dcim/moduletype/component_templates.html +++ b/netbox/templates/dcim/moduletype/component_templates.html @@ -27,7 +27,7 @@ diff --git a/netbox/templates/dcim/rack/base.html b/netbox/templates/dcim/rack/base.html index 27ac284a2..2f4eb227c 100644 --- a/netbox/templates/dcim/rack/base.html +++ b/netbox/templates/dcim/rack/base.html @@ -1,7 +1,7 @@ {% extends 'generic/object.html' %} {% load i18n %} -{% block title %}{% blocktrans %}Rack {{ object }}{% endblocktrans %}{% endblock %} +{% block title %}{% trans "Rack" %} {{ object }}{% endblock %} {% block breadcrumbs %} {{ block.super }} diff --git a/netbox/templates/dcim/virtualchassis_add_member.html b/netbox/templates/dcim/virtualchassis_add_member.html index 6f9b24183..ceb2c71b3 100644 --- a/netbox/templates/dcim/virtualchassis_add_member.html +++ b/netbox/templates/dcim/virtualchassis_add_member.html @@ -2,7 +2,11 @@ {% load form_helpers %} {% load i18n %} -{% block title %}{% blocktrans %}Add New Member to Virtual Chassis {{ virtual_chassis }}{% endblocktrans %}{% endblock %} +{% block title %} + {% blocktrans trimmed %} + Add New Member to Virtual Chassis {{ virtual_chassis }} + {% endblocktrans %} +{% endblock %} {% block content %}