Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve translation handling in JavaScript and TypeScript #2036

Merged
merged 11 commits into from
Nov 6, 2023
Next Next commit
Introduce i18n for JS/TS using Django's javascript catalog
hansegucker committed Oct 16, 2023

Verified

This commit was signed with the committer’s verified signature. The key has expired.
hansegucker Jonathan Weth
commit c218d2e0d5841e0a1cc5fab5ee9a63be90fa142a
1 change: 1 addition & 0 deletions evap/development/management/commands/translate.py
Original file line number Diff line number Diff line change
@@ -9,3 +9,4 @@ class Command(BaseCommand):
def handle(self, *args, **options):
self.stdout.write('Executing "manage.py makemessages --locale=de --ignore=node_modules/*"')
call_command("makemessages", "--locale=de", "--ignore=node_modules/*")
call_command("makemessages", "--domain=djangojs", "--extension=js,ts", "--locale=de", "--ignore=node_modules/*")
2 changes: 2 additions & 0 deletions evap/evaluation/templates/base.html
Original file line number Diff line number Diff line change
@@ -71,6 +71,8 @@

{% include 'footer.html' %}

<script src="{% url 'javascript-catalog' %}"></script>

<script type="text/javascript" src="{% static 'js/jquery-2.1.3.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/tom-select.complete.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/plugins/jquery.formset.js' %}"></script>
3 changes: 3 additions & 0 deletions evap/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import django.contrib.auth.views
from django.conf import settings
from django.urls import include, path
from django.views.i18n import JavaScriptCatalog

urlpatterns = [
path("", include('evap.evaluation.urls')),
@@ -13,6 +14,8 @@

path("logout", django.contrib.auth.views.LogoutView.as_view(next_page="/"), name="django-auth-logout"),
path("oidc/", include('mozilla_django_oidc.urls')),

path("i18n.js", JavaScriptCatalog.as_view(), name="javascript-catalog"),
hansegucker marked this conversation as resolved.
Show resolved Hide resolved
]

if settings.DEBUG: