NetTalk Central

Author Topic: Translate popup window "Alert"  (Read 2816 times)

Djordje Radovanovic

  • Full Member
  • ***
  • Posts: 237
    • View Profile
Translate popup window "Alert"
« 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


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11204
    • View Profile
Re: Translate popup window "Alert"
« Reply #1 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

Djordje Radovanovic

  • Full Member
  • ***
  • Posts: 237
    • View Profile
Re: Translate popup window "Alert"
« Reply #2 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

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Translate popup window "Alert"
« Reply #3 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

estadok

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • EstaSoft
    • Email
Re: Translate popup window "Alert"
« Reply #4 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);
« Last Edit: April 01, 2013, 10:01:30 AM by estadok »
Clarion 9.0.10376
NetTalk 7.26
SecWin 6.25
StringTheory 1.92

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11204
    • View Profile
Re: Translate popup window "Alert"
« Reply #5 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






Djordje Radovanovic

  • Full Member
  • ***
  • Posts: 237
    • View Profile
Re: Translate popup window "Alert"
« Reply #6 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