NetTalk Central

Author Topic: PR37 Translation Issues  (Read 5177 times)

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
PR37 Translation Issues
« on: May 04, 2009, 10:43:13 AM »
Hi Bruce,

You've add the Translate Method to the WebServer proc (s_web),
Supposing my translation code is thread safe, I only need to add translation code to the p_web but...
I need to translate the Buttons text, then I have to add my translation code to the s_web too.

First Q: The translation rotuine is the same for both, search a table with the string to translate, and depending on the user language replace that string.
Does it means I will search for the same string twice? one with thw s_web and other with thw p_web Translate method?

Second Q: Inside my translation routine, I need to know the user language, the user language is a session value, I get it with p_web.GSV('login_lng') in the webHandler but I cant use it in the WebServer.
How should I get the session value inside the s_web?


Alberto
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: PR37 Translation Issues
« Reply #1 on: May 04, 2009, 08:34:46 PM »
Hi Alberto,

I think you can ignore s_web.

s_web is the server. There is only one of these. The settings in here are used as defaults for the p_web (ie the handler) class. While there are lots and lots of handler objects, there is only one web server object.

Also there's no sessionid since the web server is common for all the web handler objects.

So ignore s_web for now, and if there's something you can't translate let me know.

Cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: PR37 Translation Issues
« Reply #2 on: May 05, 2009, 04:11:45 AM »
Ok Bruce,

I cant translate the Button texts defined in the WebServer proc.

Thanks
Alberto

-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: PR37 Translation Issues
« Reply #3 on: May 05, 2009, 06:25:22 AM »
In the handler what are you struggling to translate?

The text for a Save button?

Cheers
Bruce


Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: PR37 Translation Issues
« Reply #4 on: May 05, 2009, 07:52:05 AM »
Yes, I need to translate all the buttons text, Save, Change, View, etc

Thanks
Alberto
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: PR37 Translation Issues
« Reply #5 on: May 06, 2009, 06:37:36 AM »
Hi Alberto,

The button attributes are copied to the web handler when the web handler thread is created.
However at this stage the session id of the user is unknown.

So you could translate the button text immediately after the session is known - ie in the webHandler procedure, in the ProcessLink method, before the parent call.

eg
self.site.savebutton.textvalue = self.translate(self.site.savebutton.textvalue)

SaveButton is the name of the button - there are a lot of other buttons as well (see netweb.inc for a complete list.)

I recommend you cache your translation in the session queue for the buttons. Or better yet, make sure your translation procedure doesn't require any file access. (Use an In-Memory table if you can.) The stuff will get translated a LOT and so you want the minimum amount of disk activity to be involved.

Cheers
Bruce


Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: PR37 Translation Issues
« Reply #6 on: May 06, 2009, 11:02:18 AM »
Hi Bruce,

Mmmhh I dont think this is a good solution, you will be translating buttons that you will not use.

Why dont you translate the Text and the ToolTip when you create the button?

Alberto




-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: PR37 Translation Issues
« Reply #7 on: May 06, 2009, 10:04:16 PM »
yes, good question, I'm already translating the Tip there, so I've added the translate on the button text as well.

Cheers
Bruce