3 "name": "Pman.Tab.AdminTranslations",
4 "parent": "Pman.Tab.Admin",
5 "title": "Admin - Translations",
6 "path": "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminTranslations.bjs",
10 "title": "Translate App",
11 "xtype": "NestedLayoutPanel",
16 "xtype": "BorderLayout",
21 "alwaysShowTabs": true,
23 "xtype": "LayoutRegion",
28 "|activate": "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.getDataSource().reload(); \n }\n}"
34 "title": "Text in interface",
40 "|render": "function() { \n _this.grid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.panel.active) {\n _this.grid.getDataSource().reload(); \n }\n}",
41 "|beforeedit": "function(e) {\n console.log('beforeedit');\n //if (e.record.get('origtxt').indexOf('<') > -1) {\n // console.log(\"HTML EDITOR!!\");\n \n // return false;\n //}\n if (e.record.get('txt').replace(/\\s+/, '').length) {\n return true;\n }\n if (e.record.get('suggest').length) {\n e.record.set('txt', e.record.get('suggest'));\n // _this.saveRec(e.record);\n return;\n }\n \n \n \n \n var tl = e.record.get('id').split('/')[0];\n \n tl = (tl == 'zh_HK') ? 'zh-TW' : tl; \n tl = tl.replace('_', '-');\n var rec = e.record;\n \n \n \n Pman.gtranslate(e.record.get('origtxt'), 'en', tl, function(result) { \n if (typeof(result) == 'object') { //error\n return; \n }\n \n if (_this.grid.activeEditor) {\n _this.grid.activeEditor.setValue(result);\n } else {\n rec.set('txt',result);\n //_this.saveRec(rec);\n }\n\n //\n \n \n //console.log(result.translation);\n });\n \n \n \n return true;\n } ",
42 "|afteredit": "function (e)\n{\n var saveRec = function(rec)\n {\n var g = _this.grid;\n\n //g.getView().el.mask('Saving');\n Ext.Ajax.request({\n url : baseURL + '/Admin/Translations.php',\n method: 'POST',\n params : {\n id : rec.get('id'),\n txt : rec.get('txt'),\n lang : _this.langCombo.getValue(),\n module : _this.modCombo.getValue()\n },\n success : function()\n {\n //g.getView().el.unmask();\n //g.getDataSource().reload();\n },\n failure : function()\n {\n Ext.Msg.alert(\"Error\", \"There was a problem saving the data - try reloading\");\n // g.getView().el.unmask();\n }\n \n });\n };\n \n saveRec.defer(1000, _this, [ e.record ]);\n}"
45 "autoExpandColumn": "txt",
48 "xtype": "EditorGrid",
53 "|beforeload": "function (_self, opts)\n{\n\n if (!_this.langCombo || !_this.langCombo.getValue().length) {\n return false;\n }\n if (!_this.modCombo || !_this.modCombo.getValue().length) {\n return false;\n }\n opts.params = {\n lang : _this.langCombo.getValue(),\n module : _this.modCombo.getValue()\n };\n}",
54 "loadexception": "function (self, ret, load, jsonData)\n{\n Roo.MessageBox.alert(\"Error\", jsonData);\n}"
56 "*prop": "dataSource",
58 "|reader": "Pman.Readers.Category",
65 "|url": "baseURL + '/Admin/Translations.php'",
70 "xtype": "JsonReader",
74 "totalProperty": "total",
76 "|fields": "[ 'id', 'tablename', 'tableid', 'colname', 'txt', 'lang', { name:'updated', type:'date', dateFormat: 'Y-m-d H:i:s' }, { name:'origupdated', type:'date', dateFormat: 'Y-m-d H:i:s' }, 'origtxt', 'msum', 'suggest' ]",
90 "|render": "function (_self)\n{\n _this.modCombo = _self;\n}",
91 "|select": "function (combo, record, index)\n{\n _this.grid.getDataSource().reload(); \n}"
93 "valueField": "module",
94 "displayField": "module",
99 "triggerAction": "all",
100 "emptyText": "Select Module",
101 "selectOnFocus": true,
106 "xtype": "SimpleStore",
107 "|data": "(function() { \n var modlist = []; \n AppModules = typeof(AppModules) == 'undefined' ? '' : AppModules;\n Roo.each( AppModules.split(','), function(mod) { \n modlist.push( [ mod ] ); \n }); \n return modlist;\n })()",
108 "|fields": "['module']",
116 "|select": "function (combo, record, index)\n{\n _this.grid.getDataSource().reload(); \n}",
117 "|render": "function (_self)\n{\n _this.langCombo=_self;\n}"
119 "valueField": "lang",
120 "displayField": "ldisp",
125 "triggerAction": "all",
126 "emptyText": "Select Language",
127 "selectOnFocus": true,
131 "xtype": "SimpleStore",
135 "|fields": "['lang', 'ldisp']",
136 "|data": "[ [ 'zh_HK' , '\\u7E41\\u4E2D - Trad. Chin. (HK)' ], [ 'zh_CN', '\\u7C21\\u4E2D - Simp. Chin.' ] ]"
143 "xtype": "ColumnModel",
146 "dataIndex": "colname",
147 "|renderer": "function(v,x,r) { var c = '#666'; if (r.get('updated') < r.get('origupdated')) { c = 'red'; } return '<div style=\"color:'+c+'\";>' +r.get('tableid')+ ':' + v + '</div>'; }",
150 "*prop": "colModel[]"
153 "xtype": "ColumnModel",
154 "header": "Original",
156 "dataIndex": "origtxt",
157 "|renderer": "function(v,x,r) { var c = '#666'; if (r.get('updated') < r.get('origupdated')) { c = 'red'; } return '<div style=\"color:' + c+ '\">' + Ext.util.Format.htmlEncode(v) + '</div>'; }",
160 "*prop": "colModel[]"
163 "*prop": "colModel[]",
164 "dataIndex": "reset_tx",
167 "xtype": "ColumnModel",
168 "|renderer": "function(v,x,r) { var c = '#666'; if (r.get('updated') < r.get('origupdated')) { c = 'red'; } return '<div style=\"color:'+c+'\";>' +r.get('tableid')+ ':' + v + '</div>'; }",
172 "*prop": "colModel[]",
174 "header": "Translated (Click to Edit)",
176 "xtype": "ColumnModel",
177 "|renderer": "function(v,x,r) { var c = '#666'; if (r.get('updated') < r.get('origupdated')) { c = 'red'; } return '<div style=\"color:' + c+ '\">' + Ext.util.Format.htmlEncode(v) + '</div>'; }",
181 "xtype": "GridEditor",
187 "xtype": "TextField",
202 "|activate": "function() {\n _this.langpanel = this;\n if (_this.langgrid) {\n _this.langgrid.ds.load({});\n }\n}"
205 "fitContainer": true,
209 "title": "Languages and Countries",
210 "xtype": "GridPanel",
215 "|render": "function() \n{\n _this.langgrid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.langpanel.active) {\n this.ds.load({});\n }\n}",
216 "afteredit": "function (e)\n{\n var saveRec = function(rec)\n {\n var g = _this.grid;\n\n //g.getView().el.mask('Saving');\n Ext.Ajax.request({\n url : baseURL + '/Roo/I18n.php',\n method: 'POST',\n params : {\n id : rec.get('id'),\n lval : rec.get('lval')\n },\n success : function()\n {\n //g.getView().el.unmask();\n //g.getDataSource().reload();\n },\n failure : function()\n {\n Ext.Msg.alert(\"Error\", \"There was a problem saving the data - try reloading\");\n // g.getView().el.unmask();\n }\n \n });\n };\n \n saveRec.defer(1000, _this, [ e.record ]);\n}",
217 "beforeedit": "function(e) {\n console.log('beforeedit');\n //if (e.record.get('origtxt').indexOf('<') > -1) {\n // console.log(\"HTML EDITOR!!\");\n \n // return false;\n //}\n if (e.record.get('lval').replace(/\\s+/, '').length) {\n return true;\n }\n \n \n var tl = _this.langgridCombo.getValue();\n \n tl = (tl == 'zh_HK') ? 'zh-TW' : tl; \n tl = tl.replace('_', '-');\n var rec = e.record;\n \n \n \n Pman.gtranslate(e.record.get('lval_en'), 'en', tl, function(result) { \n if (typeof(result) == 'object') { //error\n return; \n }\n \n if (_this.grid.activeEditor) {\n _this.grid.activeEditor.setValue(result);\n } else {\n rec.set('lval',result);\n //_this.saveRec(rec);\n }\n\n //\n \n \n //console.log(result.translation);\n });\n \n \n \n return true;\n } "
220 "autoExpandColumn": "lval",
223 "xtype": "EditorGrid",
228 "beforeload": "function (_self, options)\n{\n options =options || {};\n options.params =options.params|| {};\n options.params.ltype = _this.langtypeCombo.getValue();\n options.params.inlang = _this.langgridCombo.getValue();\n options.params['query[_with_en]'] = 1;\n if (!options.params.ltype.length || !options.params.inlang.length) {\n return false;\n }\n \n options.params.limit = 9999;\n \n}"
230 "*prop": "dataSource",
233 "|sortInfo": "{ field : 'lkey', direction: 'ASC' }",
238 "xtype": "HttpProxy",
240 "|url": "baseURL + '/Roo/i18n.php'",
245 "xtype": "JsonReader",
246 "totalProperty": "total",
250 "|fields": "[\n {\n 'name': 'id',\n 'type': 'int'\n },\n {\n 'name': 'ltype',\n 'type': 'string'\n },\n {\n 'name': 'lkey',\n 'type': 'string'\n },\n {\n 'name': 'inlang',\n 'type': 'string'\n },\n {\n 'name': 'lval',\n 'type': 'string'\n }\n]"
261 "|render": "function (_self)\n{\n _this.langtypeCombo = _self;\n}",
262 "|select": "function (combo, record, index)\n{\n _this.langgrid.getDataSource().reload(); \n}"
264 "displayField": "lval",
266 "emptyText": "Select Translation of",
268 "selectOnFocus": true,
269 "triggerAction": "all",
271 "valueField": "lkey",
278 "xtype": "SimpleStore",
279 "|data": "[\n [ 'l', 'Language Names' ],\n [ 'c', 'Country Names' ],\n [ 'm', 'Currency Names' ]\n]",
280 "|fields": "['lkey','lval']",
287 "|select": "function (combo, record, index)\n{\n _this.langgrid.getDataSource().reload(); \n}",
288 "|render": "function (_self)\n{\n _this.langgridCombo=_self;\n}"
290 "displayField": "ldisp",
292 "emptyText": "Select Language",
294 "selectOnFocus": true,
295 "triggerAction": "all",
297 "valueField": "lang",
303 "xtype": "SimpleStore",
307 "|fields": "['lang', 'ldisp']",
308 "|data": "[ [ 'zh_HK' , '\\u7E41\\u4E2D - Trad. Chin. (HK)' ], [ 'zh_CN', '\\u7C21\\u4E2D - Simp. Chin.' ] ]"
315 "*prop": "colModel[]",
319 "xtype": "ColumnModel",
320 "|renderer": "function(v) { return String.format('{0}', v); }",
324 "*prop": "colModel[]",
325 "dataIndex": "lval_en",
328 "xtype": "ColumnModel",
329 "|renderer": "function(v) { return String.format('{0}', v); }",
333 "*prop": "colModel[]",
335 "header": "Translation",
337 "xtype": "ColumnModel",
338 "|renderer": "function(v) { return String.format('{0}', v); }",
342 "xtype": "GridEditor",
348 "xtype": "TextField",
366 "permname": "Admin.Translations",