Skip to content
Snippets Groups Projects
Commit 1a510da3 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Merge branch '124-add-i18n-for-materialize-datepicker' into 'master'

Resolve "Add i18n for materialize datepicker"

Closes #124

See merge request AlekSIS/AlekSIS!134
parents c70ba6e6 6ee0798e
No related branches found
No related tags found
1 merge request!134Resolve "Add i18n for materialize datepicker"
Pipeline #714 failed
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-21 21:04+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
#: static/js/main.js:21
msgid "Today"
msgstr ""
#: static/js/main.js:22
msgid "Cancel"
msgstr ""
#: static/js/main.js:23
msgid "OK"
msgstr ""
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-21 21:04+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: static/js/main.js:21
msgid "Today"
msgstr ""
#: static/js/main.js:22
msgid "Cancel"
msgstr ""
#: static/js/main.js:23
msgid "OK"
msgstr ""
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-21 21:04+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: static/js/main.js:21
msgid "Today"
msgstr ""
#: static/js/main.js:22
msgid "Cancel"
msgstr ""
#: static/js/main.js:23
msgid "OK"
msgstr ""
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-21 21:04+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: static/js/main.js:21
msgid "Today"
msgstr ""
#: static/js/main.js:22
msgid "Cancel"
msgstr ""
#: static/js/main.js:23
msgid "OK"
msgstr ""
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-21 21:04+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: static/js/main.js:21
msgid "Today"
msgstr ""
#: static/js/main.js:22
msgid "Cancel"
msgstr ""
#: static/js/main.js:23
msgid "OK"
msgstr ""
......@@ -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",
......
......@@ -8,8 +8,8 @@ $(document).ready( function () {
// Initialize datepicker [MAT]
$('.datepicker').datepicker({
format: 'dd.mm.yyyy',
// Translate to German
format: get_format('SHORT_DATE_FORMAT').toLowerCase().replace('d', 'dd').replace('m', 'mm').replace('y', 'yyyy'),
// Pull translations from Django helpers
i18n: {
months: calendarweek_i18n.month_names,
monthsShort: calendarweek_i18n.month_abbrs,
......@@ -18,13 +18,13 @@ $(document).ready( function () {
weekdaysAbbrev: calendarweek_i18n.day_abbrs.map(([v])=> v),
// Buttons
today: 'Heute',
cancel: 'Abbrechen',
done: 'OK',
today: gettext('Today'),
cancel: gettext('Cancel'),
done: gettext('OK'),
},
// Set monday as first day of week
firstDay: 1,
firstDay: get_format('FIRST_DAY_OF_WEEK'),
autoClose: true
});
......
......@@ -35,8 +35,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
......
......@@ -29,6 +29,7 @@ case "$1" in
for d in aleksis/core apps/official/*/aleksis/apps/*; do
echo; echo "Entering $d."
poetry run sh -c "cd $d; $manage_py makemessages --no-wrap -i static $locales"
poetry run sh -c "cd $d; $manage_py makemessages --no-wrap -d djangojs $locales"
done
exit
;;
......
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