Skip to content
Snippets Groups Projects
Verified Commit 66454ccf authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Add DJango JS i18n catalog

parent 467bf096
No related branches found
No related tags found
1 merge request!134Resolve "Add i18n for materialize datepicker"
......@@ -97,6 +97,7 @@ MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.locale.LocaleMiddleware",
"django.middleware.http.ConditionalGetMiddleware",
"django_global_request.middleware.GlobalRequestMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
......
......@@ -30,8 +30,9 @@
<script src="{% url "js_reverse" %}" type="text/javascript"></script>
{# Add i18n names for calendar (for use in datepicker) #}
{# Passing the locale is not necessary for the script to work, but prevents caching issues #}
{# Passing the locale is not necessary for the scripts to work, but prevents caching issues #}
{% get_current_language as LANGUAGE_CODE %}
<script src="{% url "javascript-catalog" %}locale={{ LANGUAGE_CODE }}" type="text/javascript"></script>
<script src="{% url "calendarweek_i18n_js" %}?first_day=6&amp;locale={{ LANGUAGE_CODE }}" type="text/javascript"></script>
{# Include jQuery to provide $(document).ready #}
......
......@@ -4,6 +4,7 @@ from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.urls import include, path
from django.views.i18n import JavaScriptCatalog
import calendarweek.django
import debug_toolbar
......@@ -40,6 +41,7 @@ urlpatterns = [
path("select2/", include("django_select2.urls")),
path("jsreverse.js", urls_js, name='js_reverse'),
path("calendarweek_i18n.js", calendarweek.django.i18n_js, name="calendarweek_i18n_js"),
path('gettext.js', JavaScriptCatalog.as_view(), name='javascript-catalog'),
]
# Serve static files from STATIC_ROOT to make it work with runserver
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment