NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Alberto on May 05, 2009, 04:18:02 AM

Title: PR37 Translation in a NetWebPage
Post by: Alberto on May 05, 2009, 04:18:02 AM
Hi,

I have a translation routine in the p_web.Translate method that works ok in almost all the site, but when I try to use the Translate method in a NetWebPage it hangs.

If I make the packet like

    packet = clip(packet) & |
    '<<br/><13,10>'&|
    '<<!-- Net:MenuWin --><13,10>'&|
    '<<br/><13,10>'&|
    '<<b>Email send failed.<</b><13,10>'&|
    '<<br/><13,10>'&|
    '<<!-- Net:PageFooter --><13,10>'&|
    ''

works ok, but if I add a translate like:
    packet = clip(packet) & |
    '<<br/><13,10>'&|
    '<<!-- Net:MenuWin --><13,10>'&|
    '<<br/><13,10>'&|
    '<<b>'&p_web.Translate('Email send failed.')&'<</b><13,10>'&|
    '<<br/><13,10>'&|
    '<<!-- Net:PageFooter --><13,10>'&|
    ''

it hangs
even if I add a message(p_web.Translate('Email sent OK.')), it hangs too
Any Idea please!?!?!

Thanks
Alberto

Title: Re: PR37 Translation in a NetWebPage
Post by: Bruce on May 05, 2009, 06:34:47 AM
make sure the string you are returnig from your Translate method is CLIPped.

If that's not it then normal debugging applies - ie determine the line of code that it is hanging on - is it before the translate, during, or after?

Cheers
Bruce
Title: Re: PR37 Translation in a NetWebPage
Post by: Alberto on May 05, 2009, 09:02:02 AM
Debuged,
Its during the ADD() command, here is my routine (without traces lines), it runs ok from every procedure except from a NetWebPage 'ResultOfSendEmail' called from the URL on save of a from procedure.

       Access:Translate.open()
       Access:Translate.UseFile()
       TRA:TranslateFrom = p_string
       get(Translate,TRA:XFROM)
       if error()
          clear(tra:record)
          TRA:TranslateFrom = p_string
          TRA:ProcedureName = GlobalErrors.GetProcedureName()
          add(Translate)                <<<<<<here it hangs>>>>>>>
          ReturnValue = p_string
       else
          ReturnValue = choose(getini('languages',p_web.GetSessionValue('LOGIN_lng'),0,'.\TRANSLAT.INI')+1, TRA:TranslateTo_00, TRA:TranslateTo_01, TRA:TranslateTo_02, TRA:TranslateTo_03, TRA:TranslateTo_04, TRA:TranslateTo_05, TRA:TranslateTo_06, TRA:TranslateTo_07, TRA:TranslateTo_08, TRA:TranslateTo_09, TRA:TranslateTo_10, TRA:TranslateTo_11, TRA:TranslateTo_12, TRA:TranslateTo_13, TRA:TranslateTo_14, TRA:TranslateTo_15, TRA:TranslateTo_16, TRA:TranslateTo_17, TRA:TranslateTo_18, TRA:TranslateTo_19, TRA:TranslateTo_20)
       end
       Access:Translate.Close()

Any Idea?
Thanks
Alberto
Title: Re: PR37 Translation in a NetWebPage
Post by: Bruce on May 05, 2009, 08:37:52 PM
Hi Alberto,

No explicit reason for it to hang on that line. Are you sure your translation file is not corrupt?

This is all normal Clarion code so you should approach it like that, and debug in the normal way.

Make sure Translate file is set to threaded, filename (if you use one) is set to threaded and so on.

Cheers
Bruce
Title: Re: PR37 Translation in a NetWebPage
Post by: Alberto on May 06, 2009, 03:12:17 AM
Can't find the problem... I have some Qs...

-In the Translate routine, I need to know the user language, then I use a SessionVariable.
In the Loginpage the user can swich from languages (to undestand the page) without been loggedIn. I´m setting a Session Variable without being loggedin. It is wonking but... can I do it?

-Which is the _life_ of a Value? I mean, when to use SetValue instead of SSV?

-If I need to check for a global parameter for all the site in the WebHandler, how can I do it? I´m reading an INI file, but is there a way to use a memory variable?

-Could you look at the General Buttons text translate problem?

Thanks
Alberto