1. suchandra tapadar
  2. PowerBuilder
  3. Monday, 23 September 2019 19:53 PM UTC

Hi,

We are working in PowerBuilder 12.5 and it has a datawindow which has static text and dynamic texts which depends on various kinds of input to the report. i need to know how can i convert those static/dynamic english texts to spanish in datawindow or programically in window. I dont need the while application conversion but only for few reports which are generated from datawindow/window we have convert the text from english to spanish. Please advise.

 

Roland Smith Accepted Answer Pending Moderation
  1. Monday, 23 September 2019 20:33 PM UTC
  2. PowerBuilder
  3. # 1

Or you could use a computed field that calls a function object. The function object would access a global DataStore that was retrieved at app startup and contains all the string translations. The function argument would be the English version of the string.

The computed field:

f_translate('What is your name?')

The function:

ll_find = gds_translate.Find("english_value = '" + as_english + "'")

If ll_find > 0 Then

     Return gds_translate.GetItemString(ll_find, "translated_value")

Else

     Return as_english

End If

 

If the app is in English mode or the string is not in the translation table, it returns the English string. If the program is in Spanish mode and english_value is found, it returns "¿Que se llamas?".

For other objects like Window, you can put this into the control constructor event:

this.text = f_translate(this.text)

Or add a function to the base window that loops through the controls and calls it.

 

Comment
  1. Roland Smith
  2. Tuesday, 24 September 2019 19:28 PM UTC
Google has a translate web service. I have not used it so I have no idea how it works.
  1. Helpful
  1. David Peace (Powersoft)
  2. Wednesday, 25 September 2019 14:03 PM UTC
It is relatively easy to translate text in a PB application if your have translation tables for the text. As I understand it you want to be able to translate any text dynamically without a translation table. Getting & changing the text in PB is simple as everyone has already said. You need a translation tool, so yes you will have to develop an interface to a tool like Google Translate. Needless to say that there will be significant performance issues for large reports.



Good luck

  1. Helpful
  1. David Peace (Powersoft)
  2. Wednesday, 25 September 2019 14:07 PM UTC
You could cache the translated text in the database for future use so the performance hit was only for the first translation, depending on your data and how often it is reported that could work quite well.
  1. Helpful
There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Monday, 23 September 2019 20:10 PM UTC
  2. PowerBuilder
  3. # 2

Each individual visual object within a DataWindow object has a name that you can reference. Example:

string ls_spanishText = "¿Que se llamas?"
dw_UserInfo.object.PersonName_t.Text = ls_spanishText

Alternative syntax:

string ls_spanishText = "¿Que se llamas?"
dw_UserInfo.Modify('PersonName_t.Text="' + ls_spanishText + '"')

That's all.

HTH /Michael

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 23 September 2019 20:05 PM UTC
  2. PowerBuilder
  3. # 3

Hi Suchandra;

  You can modify any "TEXT" object in a DW using the "Modify" command. For example:

.Modify(".Text=''")

Regards ... Chris

 

Comment
  1. suchandra tapadar
  2. Tuesday, 24 September 2019 18:38 PM UTC
Thanks Chris and Michael for the replies. But i want a general function or something which can dynamically convert any set of string given to that function. Our reports which are currently being generated in english also needs to be translated to spanish and many text in those datawindows are dynamically generated depending upon various categories.Is there a way to convert a set of strings(10 line for example ) from English to Spanish considering the content will change everytime.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.