Question


Rowan Companies
US
Last activity: 3 Mar 2019 21:25 EST
User entered Text Localization
Hi All,
We have a requirement to translate user entered text in a text area into spanish, do we have any option in to achieve this. With Localization we are achieving the drop down values, field values and messages by having localized labels created. But with our requirement we need to perform language translation for a text entered by user.
Appreciated for your valuable suggestions.
Thanks,
Sri
-
Likes (1)
Lasya Vemula -
Share this page Facebook Twitter LinkedIn Email Copying... Copied!


Pegasystems Inc.
IN
Hi
Localization requires you to create field values and for your requirement there might not be any straight forward way of doing it. If your users are entering it in text area, first you need to read the string, then split them word by word ( string tokenizer may be?), and then use a decision table or something similar to pick the translated value and then form the sentence again with translated value. So, it is a difficult. error prone process.
Other option could be using third party API like Google Translate. You can let the AI to take care of the translation.
Updated: 8 Feb 2019 7:48 EST


Coforge DPA
GB
Hi
The best way to do this dynamic transaltion is to use 3rd party API's. There is nothing OOTB in pega to do this.
Regards
Bhavya


Rowan Companies
US
Thanks much for quick responses. I am trying to use Google translation API, but for some reason in activity java step not recognizing below google api classes.
import com.google.cloud.translate.Translate;
import com.google.cloud.translate.Translate.TranslateOption;
import com.google.cloud.translate.TranslateOptions;
import com.google.cloud.translate.Translation;
Much more appreciated for help on this.
Thank You!
Sri


Pegasystems Inc.
US
Hi Sridevi,
Can you let us know what error is being shown in your activity reference and have you imported the google-cloud-translate jar file using import wizard? If so, could you try to place the jar file in your server lib directory and restart the JVM to test the behavior.
Thanks,
Mahesh M


Rowan Companies
US
Hi Mahesh,
Please find attached document with error details. I tried import wizard its not working, please suggest.
Thank You!
Sri


Pegasystems Inc.
US
Hi Sridevi,
I was able to import the google-cloud-translate-1.14.0.jar file which is downloaded from here. After import of the jar file, restart the JVM with clear cache then try to use the translate class in your activity. Hope it helps you.
Regards,
Mahesh M


Rowan Companies
US
Hi Mahesh,
I did imported all dependency jars, now i ended up below error using this API. Is there any alternative approaches to call google API using REST? Seems java code not working due to its expecting service call using Json inputs?
I am trying with activity by calling API methods? will it work. Please suggest.