aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/login
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view/login')
-rw-r--r--web/app/view/login/Login.js11
-rw-r--r--web/app/view/login/LoginController.js20
2 files changed, 31 insertions, 0 deletions
diff --git a/web/app/view/login/Login.js b/web/app/view/login/Login.js
index fdaaadcfb..49fc8e011 100644
--- a/web/app/view/login/Login.js
+++ b/web/app/view/login/Login.js
@@ -33,6 +33,17 @@ Ext.define('Traccar.view.login.Login', {
reference: 'form',
items: [{
+ xtype: 'combobox',
+ name: 'language',
+ fieldLabel: strings.login_language,
+ store: 'Languages',
+ displayField: 'name',
+ valueField: 'code',
+ submitValue: false,
+ listeners: {
+ select: 'onSelectLanguage'
+ }
+ }, {
xtype: 'textfield',
name: 'email',
fieldLabel: strings.user_email,
diff --git a/web/app/view/login/LoginController.js b/web/app/view/login/LoginController.js
index e94d0de9d..6620e07df 100644
--- a/web/app/view/login/LoginController.js
+++ b/web/app/view/login/LoginController.js
@@ -28,6 +28,26 @@ Ext.define('Traccar.view.login.LoginController', {
);
},
+ onSelectLanguage: function(selected) {
+ var paramName = 'locale';
+ var paramValue = selected.getValue();
+ var url = window.location.href;
+ if (url.indexOf(paramName + '=') >= 0) {
+ var prefix = url.substring(0, url.indexOf(paramName));
+ var suffix = url.substring(url.indexOf(paramName));
+ suffix = suffix.substring(suffix.indexOf("=") + 1);
+ suffix = (suffix.indexOf('&') >= 0) ? suffix.substring(suffix.indexOf('&')) : '';
+ url = prefix + paramName + "=" + paramValue + suffix;
+ } else {
+ if (url.indexOf('?') < 0) {
+ url += '?' + paramName + '=' + paramValue;
+ } else {
+ url += '&' + paramName + '=' + paramValue;
+ }
+ }
+ window.location.href = url;
+ },
+
onAfterRender: function(field) {
field.focus();
},