mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #13102: Establish initial translation support in templates
--------- Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
{% load helpers %}
|
||||
{% load i18n %}
|
||||
{% if customfield.type == 'integer' and value is not None %}
|
||||
{{ value }}
|
||||
{% elif customfield.type == 'longtext' and value %}
|
||||
@@ -26,7 +27,7 @@
|
||||
{% elif value %}
|
||||
{{ value }}
|
||||
{% elif customfield.required %}
|
||||
<span class="text-warning"><i class="mdi mdi-alert"></i> Not defined</span>
|
||||
<span class="text-warning"><i class="mdi mdi-alert"></i> {% trans "Not defined" %}</span>
|
||||
{% else %}
|
||||
{{ ''|placeholder }}
|
||||
{% endif %}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{% if url %}
|
||||
{% load i18n %}
|
||||
<a href="{{ url }}" type="button" class="btn btn-sm btn-success">
|
||||
<i class="mdi mdi-plus-thick"></i> Add
|
||||
<i class="mdi mdi-plus-thick"></i> {% trans "Add" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
@@ -1,3 +1,4 @@
|
||||
{% load i18n %}
|
||||
<form action="{{ form_url }}?return_url={{ return_url }}" method="post">
|
||||
{% csrf_token %}
|
||||
{% for field, value in form_data.items %}
|
||||
@@ -5,11 +6,11 @@
|
||||
{% endfor %}
|
||||
{% if bookmark %}
|
||||
<button type="submit" class="btn btn-sm btn-info">
|
||||
<i class="mdi mdi-bookmark-minus"></i> Unbookmark
|
||||
<i class="mdi mdi-bookmark-minus"></i> {% trans "Unbookmark" %}
|
||||
</button>
|
||||
{% else %}
|
||||
<button type="submit" class="btn btn-sm btn-info">
|
||||
<i class="mdi mdi-bookmark-check"></i> Bookmark
|
||||
<i class="mdi mdi-bookmark-check"></i> {% trans "Bookmark" %}
|
||||
</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{% load i18n %}
|
||||
{% if url %}
|
||||
<button type="submit" name="_delete" formaction="{{ url }}" class="btn btn-danger btn-sm">
|
||||
<i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> Delete Selected
|
||||
<i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> {% trans "Delete Selected" %}
|
||||
</button>
|
||||
{% endif %}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{% load i18n %}
|
||||
{% if url %}
|
||||
<button type="submit" name="_edit" formaction="{{ url }}" class="btn btn-warning btn-sm">
|
||||
<i class="mdi mdi-pencil" aria-hidden="true"></i> Edit Selected
|
||||
<i class="mdi mdi-pencil" aria-hidden="true"></i> {% trans "Edit Selected" %}
|
||||
</button>
|
||||
{% endif %}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{% load i18n %}
|
||||
{% if url %}
|
||||
<a href="{{ url }}" class="btn btn-sm btn-success" role="button">
|
||||
<i class="mdi mdi-content-copy" aria-hidden="true"></i> Clone
|
||||
<i class="mdi mdi-content-copy" aria-hidden="true"></i> {% trans "Clone" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
@@ -1,3 +1,4 @@
|
||||
{% load i18n %}
|
||||
<a href="#"
|
||||
hx-get="{{ url }}"
|
||||
hx-target="#htmx-modal-content"
|
||||
@@ -5,5 +6,5 @@
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#htmx-modal"
|
||||
>
|
||||
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete
|
||||
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> {% trans "Delete" %}
|
||||
</a>
|
||||
|
@@ -1,3 +1,4 @@
|
||||
{% load i18n %}
|
||||
<a href="{{ url }}" class="btn btn-sm btn-warning" role="button">
|
||||
<span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
|
||||
<span class="mdi mdi-pencil" aria-hidden="true"></span> {% trans "Edit" %}
|
||||
</a>
|
||||
|
@@ -1,10 +1,11 @@
|
||||
{% load i18n %}
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn btn-sm btn-purple dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="mdi mdi-download"></i> Export
|
||||
<i class="mdi mdi-download"></i> {% trans "Export" %}
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<li><a class="dropdown-item" href="?{% if url_params %}{{ url_params }}&{% endif %}export=table">Current View</a></li>
|
||||
<li><a class="dropdown-item" href="?{% if url_params %}{{ url_params }}&{% endif %}export">All Data ({{ data_format }})</a></li>
|
||||
<li><a class="dropdown-item" href="?{% if url_params %}{{ url_params }}&{% endif %}export=table">{% trans "Current View" %}</a></li>
|
||||
<li><a class="dropdown-item" href="?{% if url_params %}{{ url_params }}&{% endif %}export">{% trans "All Data" %} ({{ data_format }})</a></li>
|
||||
{% if export_templates %}
|
||||
<li>
|
||||
<hr class="dropdown-divider">
|
||||
@@ -24,7 +25,7 @@
|
||||
<hr class="dropdown-divider">
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item" href="{% url 'extras:exporttemplate_add' %}?content_type={{ content_type.pk }}">Add export template...</a>
|
||||
<a class="dropdown-item" href="{% url 'extras:exporttemplate_add' %}?content_type={{ content_type.pk }}">{% trans "Add export template" %}...</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{% load i18n %}
|
||||
{% if url %}
|
||||
<a href="{{ url }}" type="button" class="btn btn-sm btn-info">
|
||||
<i class="mdi mdi-upload"></i> Import
|
||||
<i class="mdi mdi-upload"></i> {% trans "Import" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
{% load i18n %}
|
||||
<form action="{{ url }}" method="post">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="btn btn-primary btn-sm">
|
||||
<i class="mdi mdi-sync" aria-hidden="true"></i> Sync
|
||||
<i class="mdi mdi-sync" aria-hidden="true"></i> {% trans "Sync" %}
|
||||
</button>
|
||||
</form>
|
||||
|
@@ -1,9 +1,10 @@
|
||||
{% load form_helpers %}
|
||||
{% load helpers %}
|
||||
{% load i18n %}
|
||||
|
||||
{% if form.errors or form.non_field_errors %}
|
||||
<div class="alert alert-danger mt-3" role="alert">
|
||||
<h4 class="alert-heading">Errors</h4>
|
||||
<h4 class="alert-heading">{% trans "Errors" %}</h4>
|
||||
{% if form.errors and '__all__' not in form.errors %}
|
||||
<hr />
|
||||
{% endif %}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{% load form_helpers %}
|
||||
{% load helpers %}
|
||||
{% load i18n %}
|
||||
|
||||
<div class="row mb-3{% if field.errors %} has-errors{% endif %}">
|
||||
|
||||
@@ -16,7 +17,7 @@
|
||||
{% if field|widget_type == 'slugwidget' %}
|
||||
<div class="input-group">
|
||||
{{ field }}
|
||||
<button id="reslug" type="button" title="Regenerate Slug" class="btn btn-outline-dark border-input">
|
||||
<button id="reslug" type="button" title="{% trans "Regenerate Slug" %}" class="btn btn-outline-dark border-input">
|
||||
<i class="mdi mdi-reload"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -40,7 +41,7 @@
|
||||
</div>
|
||||
{% elif field.field.required %}
|
||||
<div class="invalid-feedback">
|
||||
This field is required.
|
||||
{% trans "This field is required" %}.
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -53,7 +54,7 @@
|
||||
{% if bulk_nullable %}
|
||||
<div class="form-check my-1">
|
||||
<input type="checkbox" class="form-check-input" name="_nullify" value="{{ field.name }}" id="nullify_{{ field.id_for_label }}" />
|
||||
<label for="nullify_{{ field.id_for_label }}" class="form-check-label">Set Null</label>
|
||||
<label for="nullify_{{ field.id_for_label }}" class="form-check-label">{% trans "Set Null" %}</label>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
@@ -1,3 +1,4 @@
|
||||
{% load i18n %}
|
||||
{% if applied_filters %}
|
||||
<div class="mb-3">
|
||||
{% for filter in applied_filters %}
|
||||
@@ -7,12 +8,12 @@
|
||||
{% endfor %}
|
||||
{% if applied_filters|length > 1 %}
|
||||
<a href="?" class="badge rounded-pill bg-danger text-decoration-none me-1">
|
||||
<i class="mdi mdi-tag-off"></i> Clear all
|
||||
<i class="mdi mdi-tag-off"></i> {% trans "Clear all" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if save_link %}
|
||||
<a href="{{ save_link }}" class="badge rounded-pill bg-success text-decoration-none me-1">
|
||||
<i class="mdi mdi-content-save"></i> Save
|
||||
<i class="mdi mdi-content-save"></i> {% trans "Save" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
@@ -1,10 +1,11 @@
|
||||
{% load form_helpers %}
|
||||
{% load i18n %}
|
||||
|
||||
<div class="modal fade" tabindex="-1" id="{{ table_name }}_config">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Table Configuration</h5>
|
||||
<h5 class="modal-title">{% trans "Table Configuration" %}</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<form class="form-horizontal userconfigform" data-url="{% url 'users-api:userconfig-list' %}" data-config-root="tables.{{ form.table_name }}">
|
||||
@@ -16,10 +17,10 @@
|
||||
<div class="col-2 d-flex align-items-center">
|
||||
<div>
|
||||
<a class="btn btn-success btn-sm w-100 my-2" id="add_columns">
|
||||
<i class="mdi mdi-arrow-right-bold"></i> Add
|
||||
<i class="mdi mdi-arrow-right-bold"></i> {% trans "Add" %}
|
||||
</a>
|
||||
<a class="btn btn-danger btn-sm w-100 my-2" id="remove_columns">
|
||||
<i class="mdi mdi-arrow-left-bold"></i> Remove
|
||||
<i class="mdi mdi-arrow-left-bold"></i> {% trans "Remove" %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -27,16 +28,16 @@
|
||||
{{ form.columns.label }}
|
||||
{{ form.columns }}
|
||||
<a class="btn btn-primary btn-sm mt-2" id="move-option-up" data-target="id_columns">
|
||||
<i class="mdi mdi-arrow-up-bold"></i> Move Up
|
||||
<i class="mdi mdi-arrow-up-bold"></i> {% trans "Move Up" %}
|
||||
</a>
|
||||
<a class="btn btn-primary btn-sm mt-2" id="move-option-down" data-target="id_columns">
|
||||
<i class="mdi mdi-arrow-down-bold"></i> Move Down
|
||||
<i class="mdi mdi-arrow-down-bold"></i> {% trans "Move Down" %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-outline-danger" id="reset_tableconfig" value="Reset">Reset</button>
|
||||
<button type="submit" class="btn btn-primary" id="save_tableconfig" value="Save">Save</button>
|
||||
<button type="submit" class="btn btn-outline-danger" id="reset_tableconfig" value="Reset">{% trans "Reset" %}</button>
|
||||
<button type="submit" class="btn btn-primary" id="save_tableconfig" value="Save">{% trans "Save" %}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
@@ -1,9 +1,10 @@
|
||||
{% load i18n %}
|
||||
{% if widget.attrs.selector and not widget.attrs.disabled %}
|
||||
<div class="d-flex">
|
||||
{% include 'django/forms/widgets/select.html' %}
|
||||
<button
|
||||
type="button"
|
||||
title="Open selector"
|
||||
title="{% trans "Open selector" %}"
|
||||
class="btn btn-sm btn-outline-dark border-input ms-1"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#htmx-modal"
|
||||
|
@@ -1,3 +1,4 @@
|
||||
{% load i18n %}
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
{% if widget.is_initial %}
|
||||
@@ -8,7 +9,7 @@
|
||||
<label for="{{ widget.checkbox_id }}">{{ widget.clear_checkbox_label }}</label>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<span class="text-muted">None assigned</span>
|
||||
<span class="text-muted">{% trans "None assigned" %}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-6">
|
||||
|
@@ -1,13 +1,14 @@
|
||||
{% load i18n %}
|
||||
<div class="border rounded markdown-widget">
|
||||
<ul class="nav nav-tabs px-3 pt-2 rounded-top border-0">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link active " id="{{ widget.name }}-input-tab" data-bs-toggle="tab" data-bs-target="#{{ widget.name }}-input" type="button" role="tab" aria-controls="{{ widget.name }}-input" aria-selected="true">
|
||||
Write
|
||||
{% trans "Write" %}
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button hx-target="#{{ widget.name }}-preview" hx-swap="innerHTML" hx-post="{% url 'extras:render_markdown' %}" class="nav-link preview-button" id="{{ widget.name }}-markdown-preview-tab" data-bs-toggle="tab" data-bs-target="#{{ widget.name }}-markdown-preview" type="button" role="tab" aria-controls="{{ widget.name }}-markdown-preview" aria-selected="false">
|
||||
Preview
|
||||
{% trans "Preview" %}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -16,7 +17,7 @@
|
||||
{% include "django/forms/widgets/textarea.html" %}
|
||||
</div>
|
||||
<div class="tab-pane show" id="{{ widget.name }}-markdown-preview" role="tabpanel" aria-labelledby="{{ widget.name }}-markdown-preview-tab">
|
||||
<div id="{{ widget.name }}-preview" class="preview px-3 py-2">Testing</div>
|
||||
<div id="{{ widget.name }}-preview" class="preview px-3 py-2">{% trans "Testing" %}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user