From 37bc675580c640d4fa7968fee575544fb3a550e3 Mon Sep 17 00:00:00 2001 From: Gábor Somogyi Date: Fri, 6 May 2016 13:32:04 +0200 Subject: I18N added --- web/app/store/CommandTypes.js | 22 +++++++++++++++++++--- web/app/view/CommandDialog.js | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'web') diff --git a/web/app/store/CommandTypes.js b/web/app/store/CommandTypes.js index d2f9b57e4..b8cb03668 100644 --- a/web/app/store/CommandTypes.js +++ b/web/app/store/CommandTypes.js @@ -16,10 +16,10 @@ Ext.define('Traccar.store.CommandTypes', { extend: 'Ext.data.Store', - fields: ['key'], + fields: ['key', 'name'], listeners: { - 'beforeload' : function(store, eOpts) { + 'beforeload' : function(store) { var proxy; proxy = store.getProxy(); proxy.setUrl('/api/commandtypes?deviceId' + proxy.extraParams.deviceId); @@ -28,6 +28,22 @@ Ext.define('Traccar.store.CommandTypes', { proxy: { type: 'rest', - url: '' + url: '', + reader: { + type: 'json', + getData: function(data) { + Ext.each(data, function(entry) { + entry.name = entry.key; + if (typeof entry.key !== "undefined") { + var key = 'command' + entry.key.charAt(0).toUpperCase() + entry.key.slice(1); + var name = Strings[key]; + if (typeof name !== "undefined") { + entry.name = name; + } + } + }); + return data; + } + }, } }); diff --git a/web/app/view/CommandDialog.js b/web/app/view/CommandDialog.js index dff88f147..66cd190ea 100644 --- a/web/app/view/CommandDialog.js +++ b/web/app/view/CommandDialog.js @@ -31,7 +31,7 @@ Ext.define('Traccar.view.CommandDialog', { name: 'type', fieldLabel: Strings.commandType, store: 'CommandTypes', - displayField: 'key', + displayField: 'name', valueField: 'key', listeners: { select: 'onSelect' -- cgit v1.2.3