Skip to content

Commit 0cd7521

Browse files
committed
🔥(backend) remove i18n and localization from Django admin
Signed-off-by: Stephan Meijer <me@stephanmeijer.com>
1 parent b33939e commit 0cd7521

8 files changed

Lines changed: 27 additions & 71 deletions

File tree

compose.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,6 @@ services:
9898
dockerize:
9999
image: jwilder/dockerize
100100

101-
crowdin:
102-
image: crowdin/cli:3.16.0
103-
volumes:
104-
- ".:/app"
105-
env_file:
106-
- env.d/development/crowdin
107-
user: "${DOCKER_USER:-1000}"
108-
working_dir: /app
109-
110101
networks:
111102
lasuite:
112103
name: lasuite-network

crowdin/config.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/backend/core/apps.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Find Core application"""
22

33
from django.apps import AppConfig
4-
from django.utils.translation import gettext_lazy as _
54

65
from core.management.commands.create_search_pipeline import (
76
ensure_search_pipeline_exists,
@@ -16,7 +15,7 @@ class CoreConfig(AppConfig):
1615

1716
name = "core"
1817
app_label = "core"
19-
verbose_name = _("Find core application")
18+
verbose_name = "Find core application"
2019

2120
def ready(self):
2221
"""

src/backend/core/models.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from django.db.models.functions import Length
1010
from django.utils.functional import cached_property
1111
from django.utils.text import slugify
12-
from django.utils.translation import gettext_lazy as _
1312

1413
models.CharField.register_lookup(Length)
1514
TOKEN_LENGTH = 50
@@ -34,14 +33,14 @@ class Service(models.Model):
3433
client_id = models.CharField(blank=True, null=True)
3534
services = models.ManyToManyField(
3635
"self",
37-
verbose_name=_("Allowed services for search"),
36+
verbose_name="Allowed services for search",
3837
blank=True,
3938
)
4039

4140
class Meta:
4241
db_table = "find_service"
43-
verbose_name = _("service")
44-
verbose_name_plural = _("services")
42+
verbose_name = "service"
43+
verbose_name_plural = "services"
4544
ordering = ["-is_active", "-created_at"]
4645
constraints = [
4746
models.CheckConstraint(
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
{% extends "admin/change_list.html" %}
22

3-
{% load i18n admin_urls %}
3+
{% load admin_urls %}
44

55
{% block object-tools-items %}
66
<li>
77
<a href="{% url 'admin:core_service_ensure_search_pipeline' %}">
8-
{% trans "Ensure search pipeline" %}
8+
Ensure search pipeline
99
</a>
1010
</li>
1111
{{ block.super }}
1212
{% endblock %}
13-
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{% extends "admin/index.html" %}
2-
{% load i18n %}
32

43
{% block sidebar %}
54
{{ block.super }}
@@ -8,19 +7,18 @@
87
<div class="module" style="margin-top: 20px;">
98
<table>
109
<caption>
11-
{% trans 'System Tools' %}
10+
System Tools
1211
</caption>
1312
<tbody>
1413
<tr>
1514
<th scope="row">
16-
<a href="{% url 'admin:selftest' %}">{% trans 'System Self-Tests' %}</a>
15+
<a href="{% url 'admin:selftest' %}">System Self-Tests</a>
1716
</th>
18-
<td>{% trans 'Run selftest checks' %}</td>
17+
<td>Run selftest checks</td>
1918
</tr>
2019
</tbody>
2120
</table>
2221
</div>
2322
</div>
2423

2524
{% endblock %}
26-

src/backend/core/templates/admin/selftest.html

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% extends "admin/base_site.html" %}
2-
{% load i18n static %}
2+
{% load static %}
33

44
{% block extrastyle %}
55
{{ block.super }}
@@ -173,44 +173,44 @@
173173

174174
{% block breadcrumbs %}
175175
<div class="breadcrumbs">
176-
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
177-
&rsaquo; {% trans 'System Self-Tests' %}
176+
<a href="{% url 'admin:index' %}">Home</a>
177+
&rsaquo; System Self-Tests
178178
</div>
179179
{% endblock %}
180180

181181
{% block content %}
182182
<div class="selftest-container">
183183
{% if not run_tests %}
184-
<a href="?run=true" class="run-tests-btn">{% trans "Run All Tests" %}</a>
184+
<a href="?run=true" class="run-tests-btn">Run All Tests</a>
185185
{% else %}
186-
<a href="{% url 'admin:selftest' %}" class="run-tests-btn" style="opacity: 0.8;">{% trans "Reset" %}</a>
186+
<a href="{% url 'admin:selftest' %}" class="run-tests-btn" style="opacity: 0.8;">Reset</a>
187187
{% endif %}
188188

189189
{% if run_tests %}
190190
{% if all_passed is not None %}
191191
<div class="selftest-module">
192192
<div class="overall-status {% if all_passed %}success{% else %}failure{% endif %}">
193193
{% if all_passed %}
194-
{% trans "All tests passed successfully!" %}
194+
✅ All tests passed successfully!
195195
{% else %}
196-
{% trans "Some tests failed. Please check the details below." %}
196+
❌ Some tests failed. Please check the details below.
197197
{% endif %}
198198
</div>
199199
</div>
200200
{% endif %}
201201

202202
<div class="selftest-module">
203-
<h2>{% trans "Test Results" %}</h2>
203+
<h2>Test Results</h2>
204204
<div class="module-content">
205205
{% for result in results %}
206206
<div class="test-item">
207207
<div class="test-header">
208208
<span class="test-name">{{ result.name }}</span>
209209
<span class="test-status {% if result.success %}success{% else %}failure{% endif %}">
210210
{% if result.success %}
211-
{% trans "Pass" %}
211+
✓ Pass
212212
{% else %}
213-
{% trans "Fail" %}
213+
✗ Fail
214214
{% endif %}
215215
</span>
216216
</div>
@@ -223,7 +223,7 @@ <h2>{% trans "Test Results" %}</h2>
223223
</div>
224224
{% if result.details %}
225225
<div class="test-details">
226-
<strong>{% trans "Details:" %}</strong>
226+
<strong>Details:</strong>
227227
<dl>
228228
{% for key, value in result.details.items %}
229229
<dt>{{ key }}:</dt>
@@ -239,9 +239,9 @@ <h2>{% trans "Test Results" %}</h2>
239239
</div>
240240
{% else %}
241241
<div class="selftest-module">
242-
<h2>{% trans "Available Tests" %}</h2>
242+
<h2>Available Tests</h2>
243243
<div class="module-content">
244-
<p>{% trans "Click 'Run All Tests' to execute the following system health checks:" %}</p>
244+
<p>Click 'Run All Tests' to execute the following system health checks:</p>
245245
<ul class="available-tests-list">
246246
{% for test in available_tests %}
247247
<li>
@@ -255,4 +255,3 @@ <h2>{% trans "Available Tests" %}</h2>
255255
{% endif %}
256256
</div>
257257
{% endblock %}
258-

src/backend/find/settings.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
import os
1515
from socket import gethostbyname, gethostname
1616

17-
from django.utils.translation import gettext_lazy as _
18-
1917
import sentry_sdk
2018
from configurations import Configuration, values
2119
from sentry_sdk.integrations.django import DjangoIntegration
@@ -126,10 +124,10 @@ class Base(Configuration):
126124
# Languages
127125
LANGUAGES = values.SingleNestedTupleValue(
128126
(
129-
("fr", _("French")),
130-
("en", _("English")),
131-
("de", _("German")),
132-
("nl", _("Dutch")),
127+
("fr", "French"),
128+
("en", "English"),
129+
("de", "German"),
130+
("nl", "Dutch"),
133131
("und", None),
134132
)
135133
)
@@ -143,10 +141,8 @@ class Base(Configuration):
143141
)
144142
UNDETERMINED_LANGUAGE_CODE = "und"
145143

146-
LOCALE_PATHS = (os.path.join(BASE_DIR, "locale"),)
147-
148144
TIME_ZONE = "UTC"
149-
USE_I18N = True
145+
USE_I18N = False
150146
USE_TZ = True
151147

152148
# Templates
@@ -160,7 +156,6 @@ class Base(Configuration):
160156
"django.contrib.messages.context_processors.messages",
161157
"django.template.context_processors.csrf",
162158
"django.template.context_processors.debug",
163-
"django.template.context_processors.i18n",
164159
"django.template.context_processors.media",
165160
"django.template.context_processors.request",
166161
"django.template.context_processors.tz",
@@ -177,7 +172,6 @@ class Base(Configuration):
177172
"django.middleware.security.SecurityMiddleware",
178173
"whitenoise.middleware.WhiteNoiseMiddleware",
179174
"django.contrib.sessions.middleware.SessionMiddleware",
180-
"django.middleware.locale.LocaleMiddleware",
181175
"django.middleware.clickjacking.XFrameOptionsMiddleware",
182176
"corsheaders.middleware.CorsMiddleware",
183177
"django.middleware.common.CommonMiddleware",

0 commit comments

Comments
 (0)