From 643b6850df316fbe3bde3496ff471a59f75036e5 Mon Sep 17 00:00:00 2001 From: Igor Date: Thu, 13 Aug 2020 23:29:29 +0600 Subject: [PATCH] gettext js --- metadata/dbms/login.js | 32 ++++++++++----------- metadata/dbms/session.js | 2 +- metadata/dbms/showrecord.js | 56 ++++++++++++++++++------------------- metadata/dbms/tools.js | 12 ++++---- 4 files changed, 51 insertions(+), 51 deletions(-) diff --git a/metadata/dbms/login.js b/metadata/dbms/login.js index 4483dd2..2aa66b9 100644 --- a/metadata/dbms/login.js +++ b/metadata/dbms/login.js @@ -61,7 +61,7 @@ class DBMSUser { if(findNode(node,'#cdata-section').nodeValue=="0") //if not logged { - alert(_('Invalid_username_and_or_password')); + alert(trt('Invalid_username_and_or_password')); }else { //location.reload(); @@ -76,7 +76,7 @@ class DBMSUser { //if(findNode(node,'#cdata-section').nodeValue=="1") //if register //{ - // alert(_('New_user_is_registered')+'\n'+_('The_password_has_been_sent_to_you_by_Email')); + // alert(trt('New_user_is_registered')+'\n'+trt('The_password_has_been_sent_to_you_by_Email')); // location.reload(); //} } @@ -91,7 +91,7 @@ class DBMSUser { this.win=new TWin(true); this.win.BuildGUI(10,10); - this.win.setCaption(_('Authorization')); + this.win.setCaption(trt('Authorization')); this.win.setSize("350px","200px"); @@ -101,7 +101,7 @@ class DBMSUser \n\ \n\ \n\ - \n\ + \n\ \n\ \n\ \n\ @@ -111,7 +111,7 @@ class DBMSUser \n\ \n\ \n\ - \n\ + \n\
'+_('Login')+' (E-mail):'+trt('Login')+' (E-mail):
\n\ \n\ \n\ @@ -241,7 +241,7 @@ class DBMSUser \n\ \n\ \n\ - \n\ + \n\ \n\ \n\ \n\ @@ -251,7 +251,7 @@ class DBMSUser \n\ \n\ \n\ - \n\ + \n\
'+_('Login')+' (E-mail):'+trt('Login')+' (E-mail):
\n\ \n\ \n\ @@ -281,7 +281,7 @@ class DBMSUser var password=document.getElementById('tcPassword'+this.uid).value; if(login=='' || password=='') { str="Not filled in the required fields: "; - if(login=='') str+='"'+_('Login')+' (E-mail)"'; + if(login=='') str+='"'+trt('Login')+' (E-mail)"'; if(login=='' && password=='') str+=', '; if(password=='') str+='"Password"'; str+='!'; @@ -434,16 +434,16 @@ function showRestoreForm() { var win=new TWin(true); win.BuildGUI(10,10); - win.setCaption(_("Password_recovery")); + win.setCaption(trt("Password_recovery")); str='
\n\ \n\ \n\ - \n\ + \n\ \n\ \n\ - \n\ + \n\
'+_('Login')+' (E-mail)'+trt('Login')+' (E-mail)\n\
\n\ \n\
'; @@ -471,8 +471,8 @@ function showRestoreForm() var em=document.getElementById(win.uid+'_email').value; - if(em==''){ document.getElementById(win.uid+'_email').select(); alert(_('Not_filled_Email_address')); win.hideProgressBar(); return; } - if(! isEmail(em)){ document.getElementById(win.uid+'_email').select(); alert(_('Please_enter_a_valid_email_address')); win.hideProgressBar(); return; } + if(em==''){ document.getElementById(win.uid+'_email').select(); alert(trt('Not_filled_Email_address')); win.hideProgressBar(); return; } + if(! isEmail(em)){ document.getElementById(win.uid+'_email').select(); alert(trt('Please_enter_a_valid_email_address')); win.hideProgressBar(); return; } //Send AJAX reqwest to server var xml='\ @@ -495,12 +495,12 @@ function showRestoreForm() //загрузился xml документ начинаем его разбирать (по id функции в документе) var xmldoc = xmlHttpRequest.responseXML if(xmldoc==null) { - alert2(_('Alert'), _('Wrong_XML_document') + "!\n" + xmlHttpRequest.responseText); + alert2(trt('Alert'), trt('Wrong_XML_document') + "!\n" + xmlHttpRequest.responseText); return; } var node = xmldoc.documentElement; - if((node==null)||(node.getAttribute("fn")==null)) alert(_('Error')+"\n "+_("No_data")+"!\n"+xmlHttpRequest.responseText); + if((node==null)||(node.getAttribute("fn")==null)) alert(trt('Error')+"\n "+trt("No_data")+"!\n"+xmlHttpRequest.responseText); else { //alert("Принятый браузером XML=\n"+getXMLNodeSerialisation(node)); @@ -518,7 +518,7 @@ function showRestoreForm() } }else { - if(confirm(_('Failed_to_get_data')+"\n URL: "+url+"\n"+xmlHttpRequest.statusText+"\nRedo the request?")) + if(confirm(trt('Failed_to_get_data')+"\n URL: "+url+"\n"+xmlHttpRequest.statusText+"\nRedo the request?")) { var call=new myXMLHttpRequest(this); call.callServer(url,xmlString); diff --git a/metadata/dbms/session.js b/metadata/dbms/session.js index 690f5a7..b083c49 100644 --- a/metadata/dbms/session.js +++ b/metadata/dbms/session.js @@ -25,7 +25,7 @@ function CheckSession(path) clearTimeout(this.timer); //alert('Ваша сессия завершилась!'); //location.reload(); - alert2(_("Alert"),'Ваша сессия завершилась! При нажатии на “OK” страница перезагрузится, а при нажатии на “X“ закроется сообщение.').onclick=function(){ location.reload(); }; + alert2(trt("Alert"),'Ваша сессия завершилась! При нажатии на “OK” страница перезагрузится, а при нажатии на “X“ закроется сообщение.').onclick=function(){ location.reload(); }; } } } diff --git a/metadata/dbms/showrecord.js b/metadata/dbms/showrecord.js index 2054fd6..1e01ded 100644 --- a/metadata/dbms/showrecord.js +++ b/metadata/dbms/showrecord.js @@ -46,17 +46,17 @@ class SRec applyReq(req,fn,node,xmldoc) { - //alert2(_('Alert'),getXMLNodeSerialisation(node)); + //alert2(trt('Alert'),getXMLNodeSerialisation(node)); this.hideProgressBar(); this.xmldoc=node.ownerDocument; //xmldoc; if (fn==-1) //Information menu { - alert2(_('Alert'),findFirstNode(node,'#cdata-section').nodeValue); + alert2(trt('Alert'),findFirstNode(node,'#cdata-section').nodeValue); }else if (fn==0) { - //alert2(_('Alert'),getXMLNodeSerialisation(node)); + //alert2(trt('Alert'),getXMLNodeSerialisation(node)); this.setMetadata(node); this.updateSize(); }else @@ -81,10 +81,10 @@ class SRec if(this.rwin!=null) { this.rwin.hideProgressBar(); - this.rwin.setContent('
'+_('Download_report')+': "'+this.win.getCaption().innerHTML+'".
'); + this.rwin.setContent('
'+trt('Download_report')+': "'+this.win.getCaption().innerHTML+'".
'); } }else - alert2(_('Alert'),"Unknown function! fn=\""+fn+"\"" ); + alert2(trt('Alert'),"Unknown function! fn=\""+fn+"\"" ); } //Edit the GUI filter from the xml string. @@ -150,11 +150,11 @@ class SRec \ \ \ - \ - \ - \ +
adddelexcel
\ + \ + \ \ - \ + \
adddelexcel refresh
refresh
\ \
\ @@ -234,7 +234,7 @@ class SRec //Function to fill the drop-down lists (here it is necessary to ensure that everywhere there is a "var" in front of the variables). setDataSelect(node) { - //alert2(_('Alert'),"setDataSelect = " + getXMLNodeSerialisation(node)); + //alert2(trt('Alert'),"setDataSelect = " + getXMLNodeSerialisation(node)); let nodeType,prop_id,prop,option,nodeProp,id,value,cdataNode; nodeType=findFirstNode(node, 'type'); @@ -247,7 +247,7 @@ class SRec let nodeCur=findNodeOnAttribute(nodeFilter, 'column', 'n', prop_id); if(nodeCur!=null) selector=nodeCur.getAttribute("selector"); - //alert2(_('Alert'),"nodeCur = " + getXMLNodeSerialisation(nodeCur)); + //alert2(trt('Alert'),"nodeCur = " + getXMLNodeSerialisation(nodeCur)); /*nodeCur=nodeFilter.firstChild while(nodeCur!=null) @@ -324,7 +324,7 @@ class SRec } if(count==0) { - alert2(_('Alert'),_("No_results_were_found_for_your_search")); + alert2(trt('Alert'),trt("No_results_were_found_for_your_search")); }else if(count==1) //fill without window { @@ -361,7 +361,7 @@ class SRec win.BuildGUI(pageX-10,pageY-10); win.setHeight(400); win.setContent(htmlString); - win.setCaption(document.createTextNode(_('Selection'))); + win.setCaption(document.createTextNode(trt('Selection'))); win.setParent(this.win); //win.obj=this } @@ -401,7 +401,7 @@ class SRec } }else { - alert2(_('Alert'),'Filter "'+prop_id+'" not find!'); + alert2(trt('Alert'),'Filter "'+prop_id+'" not find!'); } } @@ -435,7 +435,7 @@ class SRec columnNode = columnNode.nextSibling; } } - //alert2(_('Alert'),getXMLNodeSerialisation(this.nodeMetadata)); + //alert2(trt('Alert'),getXMLNodeSerialisation(this.nodeMetadata)); } /** Function to send filter data to the server @@ -476,7 +476,7 @@ class SRec xs+='\n'; xs+=''; - //alert2(_('Alert'),xs); + //alert2(trt('Alert'),xs); if(this.request.callServer(ScriptName,xs)) { @@ -494,7 +494,7 @@ class SRec let td,tr,td1,td2; let nodeFilter=null; let tablefilter=document.getElementById('idfilter'+this.uid); - if (tablefilter.tBodies==null) alert2(_('Alert'),'tablefilter=null'); + if (tablefilter.tBodies==null) alert2(trt('Alert'),'tablefilter=null'); let nodeType=findFirstNode(node, "type"); this.f_pI=nodeType.getAttribute("ins");//access rights this.f_pU=nodeType.getAttribute("upd"); @@ -679,12 +679,12 @@ class SRec select.appendChild( option ); option=document.createElement("option"); option.setAttribute("value","1"); - option.appendChild(document.createTextNode(_('Yes'))); + option.appendChild(document.createTextNode(trt('Yes'))); if(value=="1") option.selected=true; select.appendChild( option ); option=document.createElement("option"); option.setAttribute("value","0"); - option.appendChild(document.createTextNode(_('Not'))); + option.appendChild(document.createTextNode(trt('Not'))); if(value=="0") option.selected=true; select.appendChild( option ); }else @@ -893,7 +893,7 @@ class SRec } td2.appendChild( table ); - }else alert2(_('Alert'),"Unknown type = "+columnNode.getAttribute("vt")); + }else alert2(trt('Alert'),"Unknown type = "+columnNode.getAttribute("vt")); tablefilter.tBodies[0].appendChild(tr); } columnNode = columnNode.nextSibling; @@ -909,7 +909,7 @@ class SRec let button = document.createElement('input'); button.className='button-secondary'; button.setAttribute("type","button"); - button.setAttribute("value",_("Filtering")); + button.setAttribute("value",trt("Filtering")); button.setAttribute("id","btnfilter_"+this.uid); button.onclick=function(obj){ return function() @@ -1039,7 +1039,7 @@ class SRec tr.appendChild(th); th=document.createElement('th'); th.appendChild( document.createTextNode('Del')); - th.title = _('Invert_selection'); + th.title = trt('Invert_selection'); th.style.cssText='width: 1%; cursor: pointer; text-decoration: underline;'; th.onmouseover=function(){ this.style.backgroundColor=g_rowColor2; }; th.onmouseout=function(){ this.style.backgroundColor='var(--header-color)'; }; @@ -1435,7 +1435,7 @@ class SRec dataalert() { let error_msg=""; - if (error_msg!="") alert2(_('Alert'),"ShowRecords: \n"+error_msg); + if (error_msg!="") alert2(trt('Alert'),"ShowRecords: \n"+error_msg); } showreport(ext) @@ -1446,8 +1446,8 @@ class SRec this.rwin.BuildGUI(pageX-10,pageY-10); this.rwin.setParent(this.win); this.rwin.setSize(280,130); - this.rwin.setCaption(_('Report')); - this.rwin.setContent('
'+_('Preparing_of_report')+'
'); + this.rwin.setCaption(trt('Report')); + this.rwin.setContent('
'+trt('Preparing_of_report')+'
'); this.appendFilter(); //Call data from server @@ -1508,7 +1508,7 @@ class SRec if(this.f_State=="1") //select one record { //Send the id of the selected record to the parent of the selected record and close the window - //alert2(_('Alert'),"id="+id+" f_PropName="+this.f_PropName+" f_TypeName="+this.f_TypeName); + //alert2(trt('Alert'),"id="+id+" f_PropName="+this.f_PropName+" f_TypeName="+this.f_TypeName); this.opener.setFilterObject(this.f_TypeName,this.f_PropName,id); this.win.Close(); }else @@ -1520,7 +1520,7 @@ class SRec //We run through the marked records and request their removal deleteRecord(recordid) { - if (confirm(_("Are_you_sure_you_want_to_delete_the_entries")+'?')) + if (confirm(trt("Are_you_sure_you_want_to_delete_the_entries")+'?')) { for(let i=0;i'+_('OK')+'\n\ + \n\ \n\ '; @@ -205,8 +205,8 @@ function confirm2(title,text,okFunc,cancelFunc) \n\ \n\  \n\ - \n\ - \\n\ + \n\ + \\n\ \n\ '; @@ -982,12 +982,12 @@ class TRequest //загрузился xml документ начинаем его разбирать (по id функции в документе) var xmldoc = xmlHttpRequest.responseXML; if(xmldoc==null){ - alert2(_('Alert'),_('Wrong_XML_document')+"!\nXML=("+xmlHttpRequest.responseText+')\nURL=('+url+')\nxmlString=('+xmlString+')'); + alert2(trt('Alert'),trt('Wrong_XML_document')+"!\nXML=("+xmlHttpRequest.responseText+')\nURL=('+url+')\nxmlString=('+xmlString+')'); return; } var node = xmldoc.documentElement; - if((node==null)||(node.getAttribute("fn")==null)) alert(_('Error')+"\n"+_('No_data')+"!\n"+xmlHttpRequest.responseText); + if((node==null)||(node.getAttribute("fn")==null)) alert(trt('Error')+"\n"+trt('No_data')+"!\n"+xmlHttpRequest.responseText); else { //alert("XML=\n"+getXMLNodeSerialisation(node)); @@ -1006,7 +1006,7 @@ class TRequest } }else { - if(confirm(_('Failed_to_get_data')+"\n URL: "+url+"\n"+xmlHttpRequest.statusText+"\nПовторить запрос?")) + if(confirm(trt('Failed_to_get_data')+"\n URL: "+url+"\n"+xmlHttpRequest.statusText+"\nПовторить запрос?")) { this.callServer(url,xmlString); };