NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Djordje Radovanovic on March 29, 2013, 04:01:32 AM

Title: Translate popup window "Alert"
Post by: Djordje Radovanovic on March 29, 2013, 04:01:32 AM
Is it possible to translate "Alert" title in PopUp window.

It would be ideal to make it as parameter to PopUp function (method).

Best regards,

  Djordje Radovanovic

Title: Re: Translate popup window "Alert"
Post by: Bruce on March 29, 2013, 06:04:10 AM
it goes through the translate method in the web handler. So you can put in one global translation there (rather than have to do it everytime.)

cheers
Bruce
Title: Re: Translate popup window "Alert"
Post by: Djordje Radovanovic on March 29, 2013, 10:34:19 PM
Default is default, but sometimes you need to alter this default value.

> it goes through the translate method in the web handler

I am sure you are right but I don't know how.

best regards,
Djordje
Title: Re: Translate popup window "Alert"
Post by: Rob Kolanko on April 01, 2013, 09:20:01 AM
The Web Handler procedure has a "Translate" embed where you can check the parameter string "p_string" for the "Alert"  then place the translation into the "p_string"  variable.
I hope this helps.
Rob Kolanko
Title: Re: Translate popup window "Alert"
Post by: estadok on April 01, 2013, 09:57:48 AM
Hi!
If I understand you right you can do some changing in netweb.js where you can find this function:

function ntAlert(m,t){
  setTimeout(function() {
        var a = jQuery(":focus");
      $("#message_alert").remove();
            if (t){
         $('body').append('<div id="message_alert" title="' + t + '">' + m + '</div>'); ! YOU CAN CHANGE TITLE HERE
      } else {   
         $('body').append('<div id="message_alert" title="Ошибка">' + m + '</div>'); ! AND HERE!
      }   [/b]
      $("#message_alert").dialog({
         resizable: false,
         modal: true,
         buttons: {
            Ok: function() {
               $(this).dialog("close");
               $("#message_alert").remove();
            }
         }   
      });            
        jQuery(a).focus();
    }, 1);
Title: Re: Translate popup window "Alert"
Post by: Bruce on April 01, 2013, 11:19:44 PM
yes, and notice also that ntalert is called by the NetWebServerWorker.Popup method in netweb.clw.
So you could override the Popup method in WebHandler as well if you liked.
The call is

return(self.Script('ntAlert(''' & self.jsParm(self._utfjs(p_text)) & ''','''&self.translate('Alert')&''');',p_Send))

of course, as you can see from the above it's easiest to just add a but of code to the .Translate method in the WebHandler;
something like; (before the parent call)

if p_string = 'Alert'
  Return 'Achtung!'
End


Cheers
Bruce





Title: Re: Translate popup window "Alert"
Post by: Djordje Radovanovic on April 02, 2013, 04:04:51 AM
Thank you all.

Translate method is sufficient to solve my problem.

Sorry for my slow learning curve.

Best regards,

Djordje Radovanovic