Added translation

Requires {% load i18n %}  within this scope as per docs: https://docs.djangoproject.com/en/4.1/topics/i18n/translation/#internationalization-in-template-code
This commit is contained in:
zandercymatics 2023-08-15 07:56:09 -06:00
parent 94ab136058
commit 3a6acd9c29
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7

View file

@ -1,5 +1,6 @@
{% extends "admin/base.html" %} {% extends "admin/base.html" %}
{% load static %} {% load static %}
{% load i18n %}
{% block title %}{% if subtitle %}{{ subtitle }} | {% endif %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %} {% block title %}{% if subtitle %}{{ subtitle }} | {% endif %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %}
@ -13,20 +14,25 @@
{% include "admin/color_theme_toggle.html" %} {% include "admin/color_theme_toggle.html" %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% comment %}
This was copied from the 'userlinks' template, with a few minor changes.
You can find that here:
https://github.com/django/django/blob/d25f3892114466d689fd6936f79f3bd9a9acc30e/django/contrib/admin/templates/admin/base.html#L59
{% endcomment %}
{% block userlinks %} {% block userlinks %}
{% if site_url %} {% if site_url %}
<a href="{{ site_url }}">View site</a> / <a href="{{ site_url }}">{% translate 'View site' %}</a> /
{% endif %} {% endif %}
{% if user.is_active and user.is_staff %} {% if user.is_active and user.is_staff %}
{% url 'django-admindocs-docroot' as docsroot %} {% url 'django-admindocs-docroot' as docsroot %}
{% if docsroot %} {% if docsroot %}
<a href="{{ docsroot }}">Documentation</a> / <a href="{{ docsroot }}">{% translate 'Documentation' %}</a> /
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if user.has_usable_password %} {% if user.has_usable_password %}
<a href="{% url 'admin:password_change' %}">Change password</a> / <a href="{% url 'admin:password_change' %}">{% translate 'Change password' %}</a> /
{% endif %} {% endif %}
<a href="{% url 'admin:logout' %}" id="admin-logout-button">Log out</a> <a href="{% url 'admin:logout' %}" id="admin-logout-button">{% translate 'Log out' %}</a>
{% include "admin/color_theme_toggle.html" %} {% include "admin/color_theme_toggle.html" %}
{% endblock %} {% endblock %}
{% block nav-global %}{% endblock %} {% block nav-global %}{% endblock %}