Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Add German localisation file for the JQuery datepicker

Roland Geider1204e8e9c388
diff --git a/manager/context_processor.py b/manager/context_processor.py
index 1d956a102..d7bed74a7 100644
--- a/manager/context_processor.py
+++ b/manager/context_processor.py
@@ -16,11 +16,16 @@
from workout_manager import get_version
+from manager.utils import load_language
+
def processor(request):
return {
# Application version
'version' : get_version(),
# Do not track header
- 'DNT': request.META.get('HTTP_DNT', False)
+ 'DNT': request.META.get('HTTP_DNT', False),
+
+ # User language
+ 'language': load_language()
}
diff --git a/manager/static/js/jquery.ui.datepicker-de.js b/manager/static/js/jquery.ui.datepicker-de.js
new file mode 100644
index 000000000..8a34d320d
--- /dev/null
+++ b/manager/static/js/jquery.ui.datepicker-de.js
@@ -0,0 +1,26 @@
+/* German initialisation for the jQuery UI date picker plugin. */
+/* Written by Milian Wolff ([email protected]). */
+jQuery(function($){
+ $.datepicker.regional['de'] = {
+ closeText: 'schließen',
+ prevText: '<zurück',
+ nextText: 'Vor>',
+ currentText: 'heute',
+ monthNames: ['Januar','Februar','März','April','Mai','Juni',
+ 'Juli','August','September','Oktober','November','Dezember'],
+ monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',
+ 'Jul','Aug','Sep','Okt','Nov','Dez'],
+ dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
+ dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
+ dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
+ weekHeader: 'Wo',
+ dateFormat: "yy-mm-dd",
+ // TODO: set ISO format because we still have troubles understanding
+ // anything else...
+ //dateFormat: 'dd.mm.yy',
+ firstDay: 1,
+ isRTL: false,
+ showMonthAfterYear: false,
+ yearSuffix: ''};
+ $.datepicker.setDefaults($.datepicker.regional['de']);
+});
diff --git a/weight/templates/weight_overview.html b/weight/templates/weight_overview.html
index 380e46835..7eb21da1e 100644
--- a/weight/templates/weight_overview.html
+++ b/weight/templates/weight_overview.html
@@ -12,6 +12,9 @@
-->
{% block header %}
<script src="{% static 'js/jquery-ui.js' %}"></script>
+{% if language.short_name == 'de' %}
+<script src="{% static 'js/jquery.ui.datepicker-de.js' %}"></script>
+{% endif %}
<script src="{% static 'js/workout-manager.js' %}"></script>
<script src="{% static 'js/d3.js' %}"></script>
<script src="{% static 'js/jquery-globalize/lib/globalize.js' %}"></script>