Преглед изворни кода

Fixes #13351: Fix missing text due to incorrectly applied translation tags

Jeremy Stretch пре 2 година
родитељ
комит
04a2543e68

+ 8 - 0
docs/release-notes/version-3.6.md

@@ -1,5 +1,13 @@
 # NetBox v3.6
 
+## v3.6-beta2 (FUTURE)
+
+### Bug Fixes
+
+* [#13351](https://github.com/netbox-community/netbox/issues/13351) - Fix missing text due to incorrectly applied translation tags
+
+---
+
 ## v3.6-beta1 (2023-08-02)
 
 ### Breaking Changes

+ 6 - 1
netbox/templates/core/job.html

@@ -54,7 +54,12 @@
             </tr>
             <tr>
               <th scope="row">{% trans "Scheduled" %}</th>
-              <td>{{ object.scheduled|annotated_date|placeholder }}{% if object.interval %} ({% blocktrans %}every {{ object.interval }} seconds{% endblocktrans %}){% endif %}</td>
+              <td>
+                {{ object.scheduled|annotated_date|placeholder }}
+                {% if object.interval %}
+                  ({% blocktrans with interval=object.interval %}every {{ interval }} seconds{% endblocktrans %})
+                {% endif %}
+              </td>
             </tr>
             <tr>
               <th scope="row">{% trans "Started" %}</th>

+ 5 - 1
netbox/templates/dcim/bulk_disconnect.html

@@ -5,7 +5,11 @@
 {% block title %}{% trans "Disconnect" %} {{ obj_type_plural|bettertitle }}{% endblock %}
 
 {% block message %}
-    <p>{% blocktrans %}Are you sure you want to disconnect these {{ selected_objects|length }} {{ obj_type_plural }}?{% endblocktrans %}</p>
+    <p>
+      {% blocktrans with count=selected_objects|length %}
+        Are you sure you want to disconnect these {{ count }} {{ obj_type_plural }}?
+      {% endblocktrans %}
+    </p>
     <ul>
         {% for obj in selected_objects %}
             <li>{{ obj }}</li>

+ 5 - 1
netbox/templates/dcim/cable_trace.html

@@ -2,7 +2,11 @@
 {% load helpers %}
 {% load i18n %}
 
-{% block title %}{% blocktrans %}Cable Trace for {{ object|meta:"verbose_name"|bettertitle }} {{ object }}{% endblocktrans %}{% endblock %}
+{% block title %}
+  {% blocktrans with object_type=object|meta:"verbose_name"|bettertitle %}
+    Cable Trace for {{ object_type }} {{ object }}
+  {% endblocktrans %}
+{% endblock %}
 
 {% block content %}
     <div class="row">

+ 3 - 1
netbox/templates/dcim/device.html

@@ -295,7 +295,9 @@
                                     </tr>
                                     {% for leg in utilization.legs %}
                                         <tr>
-                                            <td style="padding-left: 20px">{% blocktrans %}Leg {{ leg.name }}{% endblocktrans %}</td>
+                                            <td style="padding-left: 20px">
+                                              {% trans "Leg" context "Leg of a power feed" %} {{ leg }}
+                                            </td>
                                             <td>{{ leg.outlet_count }}</td>
                                             <td>{{ leg.allocated }}</td>
                                             {% if powerfeed.available_power %}

+ 10 - 2
netbox/templates/dcim/devicebay_depopulate.html

@@ -2,8 +2,16 @@
 {% load form_helpers %}
 {% load i18n %}
 
-{% block title %}{% blocktrans %}Remove {{ device_bay.installed_device }} from {{ device_bay }}?{% endblocktrans %}{% endblock %}
+{% block title %}
+  {% blocktrans with device=device_bay.installed_device %}
+    Remove {{ device }} from {{ device_bay }}?
+  {% endblocktrans %}
+{% endblock %}
 
 {% block message %}
-    <p>{% blocktrans %}Are you sure you want to remove <strong>{{ device_bay.installed_device }}</strong> from <strong>{{ device_bay }}</strong>?{% endblocktrans %}</p>
+  <p>
+    {% blocktrans with device=device_bay.installed_device %}
+      Are you sure you want to remove <strong>{{ device }}</strong> from <strong>{{ device_bay }}</strong>?
+    {% endblocktrans %}
+  </p>
 {% endblock %}

+ 8 - 2
netbox/templates/dcim/inc/nonracked_devices.html

@@ -34,11 +34,17 @@
         {%  if total_nonracked_devices_count > nonracked_devices.count %}
             {% if object|meta:'verbose_name' == 'site' %}
                 <div class="text-muted">
-                    {% blocktrans %}Displaying {{ nonracked_devices.count }} of {{ total_nonracked_devices_count }} devices{% endblocktrans %} (<a href="{% url 'dcim:device_list' %}?site_id={{ object.pk }}&rack_id=null">{% trans "View full list" %}</a>)
+                  {% blocktrans with count=nonracked_devices.count total=total_nonracked_devices_count %}
+                    Displaying {{ count }} of {{ total }} devices
+                  {% endblocktrans %}
+                  (<a href="{% url 'dcim:device_list' %}?site_id={{ object.pk }}&rack_id=null">{% trans "View full list" %}</a>)
                 </div>
             {% elif object|meta:'verbose_name' == 'location' %}
                 <div class="text-muted">
-                    {% blocktrans %}Displaying {{ nonracked_devices.count }} of {{ total_nonracked_devices_count }} devices{% endblocktrans %} (<a href="{% url 'dcim:device_list' %}?location_id={{ object.pk }}&rack_id=null">{% trans "View full list" %}</a>)
+                  {% blocktrans with count=nonracked_devices.count total=total_nonracked_devices_count %}
+                    Displaying {{ count }} of {{ total }} devices
+                  {% endblocktrans %}
+                  (<a href="{% url 'dcim:device_list' %}?location_id={{ object.pk }}&rack_id=null">{% trans "View full list" %}</a>)
                 </div>
             {% endif %}
         {% endif %}

+ 5 - 1
netbox/templates/dcim/virtualchassis_edit.html

@@ -3,7 +3,11 @@
 {% load form_helpers %}
 {% load i18n %}
 
-{% block title %}{% blocktrans %}Editing Virtual Chassis {{ vc_form.instance }}{% endblocktrans %}{% endblock %}
+{% block title %}
+  {% blocktrans with name=vc_form.instance %}
+    Editing Virtual Chassis {{ name }}
+  {% endblocktrans %}
+{% endblock %}
 
 {% block content-wrapper %}
   <div class="tab-content">

+ 5 - 1
netbox/templates/dcim/virtualchassis_remove_member.html

@@ -5,5 +5,9 @@
 {% block title %}{% trans "Remove Virtual Chassis Member" %}?{% endblock %}
 
 {% block message %}
-    <p>{% blocktrans %}Are you sure you want to remove <strong>{{ device }}</strong> from virtual chassis {{ device.virtual_chassis }}?{% endblocktrans %}</p>
+  <p>
+    {% blocktrans with name=device.virtual_chassis %}
+      Are you sure you want to remove <strong>{{ device }}</strong> from virtual chassis {{ name }}?
+    {% endblocktrans %}
+  </p>
 {% endblock %}

+ 1 - 1
netbox/templates/extras/configrevision_restore.html

@@ -9,7 +9,7 @@
 
 {% block subtitle %}
   <div class="object-subtitle">
-    <span>{% blocktrans %}Created {{ object.created|annotated_date }}{% endblocktrans %}</span>
+    <span>{% trans "Created" %} {{ object.created|annotated_date }}</span>
   </div>
 {% endblock %}
 

+ 3 - 1
netbox/templates/generic/bulk_add_component.html

@@ -4,7 +4,9 @@
 {% load render_table from django_tables2 %}
 {% load i18n %}
 
-{% block title %}{% blocktrans %}Add {{ model_name|title }}{% endblocktrans %}{% endblock %}
+{% block title %}
+  {% trans "Add" %} {{ model_name|title }}
+{% endblock %}
 
 {% block tabs %}
   <ul class="nav nav-tabs px-3">

+ 3 - 1
netbox/templates/generic/bulk_delete.html

@@ -14,7 +14,9 @@ Context:
   return_url: The URL to which the user is redirected after submitting the form
 {% endcomment %}
 
-{% block title %}{% blocktrans %}Delete {{ table.rows|length }} {{ model|meta:"verbose_name_plural"|bettertitle }}?{% endblocktrans %}{% endblock %}
+{% block title %}
+  {% trans "Delete" %} {{ table.rows|length }} {{ model|meta:"verbose_name_plural"|bettertitle }}?
+{% endblock %}
 
 {% block content %}
   <div class="container-md px-0">

+ 3 - 1
netbox/templates/generic/bulk_edit.html

@@ -12,7 +12,9 @@ Context:
   return_url: The URL to which the user is redirected after submitting the form
 {% endcomment %}
 
-{% block title %}{% blocktrans %}Editing {{ table.rows|length }} {{ model|meta:"verbose_name_plural"|bettertitle }}{% endblocktrans %}{% endblock %}
+{% block title %}
+  {% trans "Editing" %} {{ table.rows|length }} {{ model|meta:"verbose_name_plural"|bettertitle }}
+{% endblock %}
 
 {% block tabs %}
   <ul class="nav nav-tabs px-3">

+ 18 - 4
netbox/templates/generic/bulk_remove.html

@@ -3,15 +3,25 @@
 {% load render_table from django_tables2 %}
 {% load i18n %}
 
-{% block title %}{% blocktrans %}Remove {{ table.rows|length }} {{ obj_type_plural|bettertitle }}?{% endblocktrans %}{% endblock %}
+{% block title %}
+  {% trans "Remove" %} {{ table.rows|length }} {{ obj_type_plural|bettertitle }}?
+{% endblock %}
 
 {% block content %}
 <div class="container-md px-0">
   <div class="alert alert-danger" role="alert">
     <h4 class="alert-heading">{% trans "Confirm Bulk Removal" %}</h4>
-    <p><strong>{% blocktrans %}Warning:</strong> The following operation will remove {{ table.rows|length }} {{ obj_type_plural }} from {{ parent_obj }}.{% endblocktrans %}</p>
+    <p>
+      {% blocktrans with count=table.rows|length %}
+        <strong>Warning:</strong> The following operation will remove {{ count }} {{ obj_type_plural }} from {{ parent_obj }}.
+      {% endblocktrans %}
+    </p>
     <hr />
-    <p class="mb-0">{% blocktrans %}Please carefully review the {{ obj_type_plural }} to be removed and confirm below.{% endblocktrans %}</p>
+    <p class="mb-0">
+      {% blocktrans %}
+        Please carefully review the {{ obj_type_plural }} to be removed and confirm below.
+      {% endblocktrans %}
+    </p>
   </div>
 </div>
 <div class="container-xl px-0">
@@ -24,7 +34,11 @@
       {{ field }}
     {% endfor %}
     <div class="text-center">
-      <button type="submit" name="_confirm" class="btn btn-danger">{% blocktrans %}Delete these {{ table.rows|length }} {{ obj_type_plural }}{% endblocktrans %}</button>
+      <button type="submit" name="_confirm" class="btn btn-danger">
+        {% blocktrans with count=table.rows|length %}
+          Delete these {{ count }} {{ obj_type_plural }}
+        {% endblocktrans %}
+      </button>
       <a href="{{ return_url }}" class="btn btn-outline-dark">{% trans "Cancel" %}</a>
     </div>
   </form>

+ 3 - 1
netbox/templates/generic/bulk_rename.html

@@ -3,7 +3,9 @@
 {% load form_helpers %}
 {% load i18n %}
 
-{% block title %}{% blocktrans %}Renaming {{ selected_objects|length }} {{ obj_type_plural|bettertitle }}{% endblocktrans %}{% endblock %}
+{% block title %}
+  {% trans "Renaming" %} {{ selected_objects|length }} {{ obj_type_plural|bettertitle }}
+{% endblock %}
 
 {% block content %}
 <div class="row mb-3">

+ 3 - 1
netbox/templates/generic/object_delete.html

@@ -11,7 +11,9 @@ Context:
   return_url: The URL to which the user is redirected after submitting the form
 {% endcomment %}
 
-{% block title %}{% blocktrans %}Delete {{ object|meta:"verbose_name" }}?{% endblocktrans %}{% endblock %}
+{% block title %}
+  {% trans "Delete" %} {{ object|meta:"verbose_name" }}?
+{% endblock %}
 
 {% block header %}{% endblock %}
 

+ 7 - 1
netbox/templates/generic/object_edit.html

@@ -13,7 +13,13 @@ Context:
 {% endcomment %}
 
 {% block title %}
-  {% if object.pk %}{% blocktrans %}Editing {{ object|meta:"verbose_name" }} {{ object }}{% endblocktrans %}{% else %}{% blocktrans %}Add a new {{ object|meta:"verbose_name" }}{% endblocktrans %}{% endif %}
+  {% if object.pk %}
+    {% trans "Editing" %} {{ object|meta:"verbose_name" }} {{ object }}
+  {% else %}
+    {% blocktrans with object_type=object|meta:"verbose_name" %}
+      Add a new {{ object_type }}
+    {% endblocktrans %}
+  {% endif %}
 {% endblock title %}
 
 {% block tabs %}

+ 3 - 1
netbox/templates/generic/object_list.html

@@ -91,7 +91,9 @@ Context:
                 <div class="form-check">
                   <input type="checkbox" id="select-all" name="_all" class="form-check-input" />
                   <label for="select-all" class="form-check-label">
-                    {% blocktrans %}Select <strong>all {{ table.rows|length }} {{ table.data.verbose_name_plural }}</strong> matching query{% endblocktrans %}
+                    {% blocktrans with count=table.rows|length object_type_plural=table.data.verbose_name_plural %}
+                      Select <strong>all {{ count }} {{ object_type_plural }}</strong> matching query
+                    {% endblocktrans %}
                   </label>
                 </div>
               </div>

+ 5 - 1
netbox/templates/htmx/delete_form.html

@@ -7,7 +7,11 @@
     <h5 class="modal-title">{% trans "Confirm Deletion" %}</h5>
   </div>
   <div class="modal-body">
-    <p>{% blocktrans %}Are you sure you want to <strong class="text-danger">delete</strong> {{ object_type }} <strong>{{ object }}</strong>?{% endblocktrans %}</p>
+    <p>
+      {% blocktrans %}
+        Are you sure you want to <strong class="text-danger">delete</strong> {{ object_type }} <strong>{{ object }}</strong>?
+      {% endblocktrans %}
+    </p>
     {% render_form form %}
   </div>
   <div class="modal-footer">

+ 1 - 1
netbox/templates/htmx/object_selector.html

@@ -2,7 +2,7 @@
 {% load i18n %}
 
 <div class="modal-header">
-  <h5 class="modal-title">{% blocktrans %}Select {{ model|meta:"verbose_name"|bettertitle }}{% endblocktrans %}</h5>
+  <h5 class="modal-title">{% trans "Select" %} {{ model|meta:"verbose_name"|bettertitle }}</h5>
   <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
 </div>
 <div class="modal-body row">

+ 4 - 2
netbox/templates/inc/missing_prerequisites.html

@@ -3,8 +3,10 @@
 
 <div class="alert alert-warning text-end" role="alert">
   <div class="float-start">
-    <i class="mdi mdi-alert"></i> {% blocktrans %}Before you can add a {{ model|meta:"verbose_name" }} you must first create a
-      <strong>{{ prerequisite_model|meta:"verbose_name" }}</strong>.{% endblocktrans %}
+    <i class="mdi mdi-alert"></i>
+    {% blocktrans with model=model|meta:"verbose_name" prerequisite_model=prerequisite_model|meta:"verbose_name" %}
+      Before you can add a {{ model }} you must first create a <strong>{{ prerequisite_model }}</strong>.
+    {% endblocktrans %}
   </div>
   {% add_button prerequisite_model %}
 </div>

+ 3 - 1
netbox/templates/inc/paginator.html

@@ -46,7 +46,9 @@
         </ul>
       </div>
       <small class="text-end text-muted">
-        {% blocktrans %}Showing {{ page.start_index }}-{{ page.end_index }} of {{ page.paginator.count }}{% endblocktrans %}
+        {% blocktrans with start=page.start_index end=page.end_index total=page.paginator.count %}
+          Showing {{ start }}-{{ end }} of {{ total }}
+        {% endblocktrans %}
       </small>
     {% endif %}
   </div>

+ 3 - 1
netbox/templates/inc/paginator_htmx.html

@@ -66,7 +66,9 @@
         </ul>
       </div>
       <small class="text-end text-muted">
-        {% blocktrans %}Showing {{ page.start_index }}-{{ page.end_index }} of {{ page.paginator.count }}{% endblocktrans %}
+        {% blocktrans with start=page.start_index end=page.end_index total=page.paginator.count %}
+          Showing {{ start }}-{{ end }} of {{ total }}
+        {% endblocktrans %}
       </small>
     {% endif %}
   </div>

+ 5 - 1
netbox/templates/virtualization/cluster_add_devices.html

@@ -5,7 +5,11 @@
 
 {% render_errors form %}
 
-{% block title %}{% blocktrans %}Add Device to Cluster {{ cluster }}{% endblocktrans %}{% endblock %}
+{% block title %}
+  {% blocktrans %}
+    Add Device to Cluster {{ cluster }}
+  {% endblocktrans %}
+{% endblock %}
 
 {% block content %}
     <form action="." method="post">