NetTalk Central

Author Topic: UI runtime translation  (Read 3492 times)

tglomb

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
    • AObit Software
    • Email
UI runtime translation
« on: March 20, 2014, 07:56:27 AM »
Does anybody knows a way of a translation of all text at runtime ? In my project I must let the enduser select at runtime a certain language, at least German, English, Italian, .. with a single click on a button. Is it possible todo via mapping tables for any elements in the UI ?
Any ideas apreciated !
TIA, Thomas

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: UI runtime translation
« Reply #1 on: March 20, 2014, 08:44:33 AM »
Yes, Nt has a Translate Method that is used almost in every part of the Nt.

Then you have to go to the Translate method in the WebHandler, before the parencall and add some code like the following:


    Returnvalue = p_string

       TRA:TranslateFrom = p_string
       get(Translate,TRA:XFROM)
       if error() !traslate string not found then I add a record to the transaltion file (I use a TPS file)
          if loc:Add=1  !getini('translation','add',1,'.\TRANSLAT.INI')=1
             clear(tra:record)
             TRA:TranslateFrom = p_string
             !Trace('Adding Translate From: '&TRA:TranslateFrom)
             TRA:ProcedureName = GlobalErrors.GetProcedureName()
             Access:Translate.TryInsert()
          end
          ReturnValue = ''
       else
          if loc:Repair=1 !getini('translation','repair',0,'.\TRANSLAT.INI')=1
             TRA:TranslateFrom = p_string
             TRA:ProcedureName = GlobalErrors.GetProcedureName()
             PUT(Translate)
          END
          ReturnValue = choose(p_web.gsv('LOGIN_lngCol')+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)
          !p_web.AddLog('Translate: '&p_String&' '&p_web.gsv('LOGIN_lngCol')&' '&clip(ReturnValue))
       end

       if ReturnValue = ''
          ReturnValue = p_string
       end

    end

    ReturnValue = parent.Translate(ReturnValue,p_AllowHtml)
    Return clip(ReturnValue)

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

tglomb

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
    • AObit Software
    • Email
Re: UI runtime translation
« Reply #2 on: March 20, 2014, 11:36:47 AM »
Thanks Michaelis,
it works well, I was not aware of this procedure.. I not found a description of all the methods up to now (besides the class embeds)..
It is correct that the 00 to 20 representing the placeholders for your languages ?
Ciao Thomas

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: UI runtime translation
« Reply #3 on: March 20, 2014, 12:33:39 PM »
Yes its correct, I save my langues in one table, many columns.
Regards
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: UI runtime translation
« Reply #4 on: March 20, 2014, 10:08:04 PM »
Hi Thomas,

you may also be interested in AnyText, which now has support for NetTalk web apps "built-in". see
http://www.capesoft.com/docs/anytext/anytext.htm
and specifically
http://www.capesoft.com/docs/anytext/anytext.htm#web
for more.

cheers
Bruce