diff --git a/CHANGELOG b/CHANGELOG
index 6d6a896491..395a1e5ca6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,4 @@
+* Make datetimepicker locale aware
* Restore tab default order when no manual change
* Add support for column sorting
* Manage confirm attribute on buttons
diff --git a/index.html b/index.html
index a2f1dad8e7..17c2724416 100644
--- a/index.html
+++ b/index.html
@@ -12,6 +12,7 @@ this repository contains the full copyright notices and license terms. -->
+
diff --git a/src/sao.js b/src/sao.js
index d4cb8cedc3..a6ce7b9655 100644
--- a/src/sao.js
+++ b/src/sao.js
@@ -189,7 +189,14 @@ var Sao = {};
Sao.i18n = i18n();
Sao.i18n.setlang = function(lang) {
+ if (!lang) {
+ lang = (navigator.language ||
+ navigator.browserLanguage ||
+ navigator.userLanguage ||
+ 'en_US').replace('-', '_');
+ }
Sao.i18n.setLocale(lang);
+ moment.locale(lang.slice(0, 2));
return jQuery.getJSON('locale/' + lang + '.json', function(data) {
if (!data[''].language) {
data[''].language = lang;
@@ -210,11 +217,7 @@ var Sao = {};
Sao.i18n.getlang = function() {
return Sao.i18n.getLocale();
};
- Sao.i18n.setlang(
- (navigator.language ||
- navigator.browserLanguge ||
- navigator.userLanguage ||
- 'en_US').replace('-', '_'));
+ Sao.i18n.setlang();
Sao.get_preferences = function() {
var session = Sao.Session.current_session;
diff --git a/src/screen.js b/src/screen.js
index 8dd4e2db15..0aebf9129b 100644
--- a/src/screen.js
+++ b/src/screen.js
@@ -537,7 +537,9 @@
}).append(jQuery('', {
'class': 'glyphicon glyphicon-calendar'
}))).appendTo(entry);
- entry.datetimepicker();
+ entry.datetimepicker({
+ 'locale': moment.locale()
+ });
entry.data('DateTimePicker').format(format);
return entry;
};
diff --git a/src/view/form.js b/src/view/form.js
index a655f73ee0..9f23d138c8 100644
--- a/src/view/form.js
+++ b/src/view/form.js
@@ -1056,7 +1056,9 @@
}).append(jQuery('', {
'class': 'glyphicon glyphicon-calendar'
}))).appendTo(this.date);
- this.date.datetimepicker();
+ this.date.datetimepicker({
+ 'locale': moment.locale()
+ });
this.date.css('width', this._width);
this.date.on('dp.hide', this.focus_out.bind(this));
},
@@ -3647,7 +3649,8 @@
'class': 'glyphicon glyphicon-calendar'
})).prependTo(group);
this.input.datetimepicker({
- 'format': Sao.common.moment_format(this.format)
+ 'format': Sao.common.moment_format(this.format),
+ 'locale': moment.locale()
});
this.input.on('dp.hide',
this.parent_widget.focus_out.bind(this.parent_widget));