Localizing a warning message from a Directed Web Access link
When your application users use Directed Web Access (DWA) for a Pega Survey, you want them to see a warning message that is localized for their locale when they close the survey. In the example provided here, the English language pyCaption warning message that is displayed when users close the survey is localized for German.
Following the example, you create a field value pyCaption warning msg for the message text that you want to localize in the Pega Survey.
- Create a field value to store the message you want to localize, for example, pyCaption warning msg.
Specify the values for the following fields:
Field Name: pyCaption
Field Value: warning_msg
Localized Label: Specify any warning message that you want to display, for example:
Are you sure you want to exit this page? If you leave the page now, the survey will be locked for 120 minutes.
Field Value pyCaption warning_msg with Localized Label
- Create a single-value text property that maps to the field value created in Step 1.
Single-value property pxTextInput for Field Value pyCaption
For example, here is a section that application users view.
Section label for the warning message
- Drag a layout of type free form 1 X 1.
- Insert a label in that cell.
- Configure the cell properties as follows:
Label For: .warning_msg
Inline Style: display:none; (This value hides the cell; it does not occupy space.)
Cell properties for warning message
Follow this example, adapting it to meet your needs:
var warn_msg = ""; //Empty the warning message variable
/*Add a listener function to fetch the warning message from the html*/
if(window.attachEvent) //For Internet Explorer 8 and earlier
window addEventListener(‘onload’, initPage); //For Internet Explorer 9 and later and Chrome and FireFox
/* The function below will fetch the localized value from the warning_msg label that you added to the section of the survey */
var labels = document.getElementsByTagName("label");
for(var i=0;i< labels.length;i++)
warn_msg = labels[i].innerText;
break; // break from the loop when the message is found
/* Add another event listener to the Submit button to clear the warning message so that it is not displayed if the user actually submits the form and does not close it without completing it. You want to show the warning only if the user has not completed the survey */
/*Attach the listener to the window so that it displays a warning message when it is being closed.
//Method to clear the message so that warning message is not displayed on Submit
//Method to show the localized warning message
Using the Localize Application wizard, you import the language ruleset (German, in this example) and follow the remaining steps to create the language pack. When you are done, you have a .zip file of the language translation for use in your application.
- From the User Interface landing page, click
User Interface landing page > Tools > Translate to New Language
to open the Localize Application wizard.
- In the Localize Application wizard, select the application ruleset and version.
Localize Application wizard, Step 1, Select Application Rule Sets
- Wait for the system to verify that localization is enabled for all user interface components of your application.
Localize Application wizard, Step 2, Verify Localization Is On
- Optionally, perform manual tasks outside of the wizard to update the rules, properties, and portals as needed.
Localize Application wizard, Step 3, Manual Tasks
- Select the language that you want for localization, for example, German.
Localize Application wizard, Step 4, Select Languages
Check for the language pack, selecting the option that applies to your application:
Acquired the Pegasystems language pack
Add all PRPC field values to my application translation pack
Already translated the PRPC field values or not using out-of-box components
In this example, the first option is selected: Acquired the Pegasystems language pack.
Localize Application wizard, Step 5, Check for Language Pack
Set the options for handling an existing translation of the field and providing sample files and base field values from any rulesets.
Localize Application wizard, Step 6, Set Options
Export the translation by clicking the language to create the translation pack .zip file.
Localize Application wizard, Step 7, Export Translations
When prompted, save the translation pack .zip file to a local folder.
Prompt to open or save the language pack .zip file
Close the Localize Application wizard.
In the downloaded language pack, you work with the TextToTranslate.xml file to apply the localized message to your application. Then you return to the Localize Application wizard to work with the translation that is in progress. You import the translated language ruleset, upload the language pack, and view the results of the translation.
- Extract the downloaded language pack and open the TextToTranslate.xml file to see the English language label.
- Browse the folder to find the TextToTranslate.xml file.
Downloaded language pack TranslationFiles lists the TextToTranslate.xml file
Open the TextToTranslate.xml file and find the localized English label.
Remember to open the TextToTranslate.xml file in Microsoft Excel because this is the format that is required for modifying and delivering the language pack.
- Browse the folder to find the TextToTranslate.xml file.
In the Translation column, enter the Translated Warning message. Save and close the file.
Translation column holds translated warning message
Archive the folder again: Create a .zip file again of the extracted folder.
In PRPC, from thelanding page, click .
User Interface landing page, Tools, List Translations in Progress
Select the language, for example, German.
Wizards In progress, Open, Import German translations
In the Localize Application wizard,, specify the German language ruleset and version.
Important Make sure that the language ruleset version matches the base ruleset version. If the language ruleset does not match the base ruleset, the Field Value rule is not selected for translation.
Localize Application wizard, Step 1, Select Import Rule Sets
Upload the translation pack .zip file that contains the German translations by browsing and selecting the file.
Localize Application wizard, Step 2, Upload Translation Pack
See the confirmation message: File uploaded successfully.
Localize Application wizard, Step 2, Successful upload of translation pack
Click Next to complete the Localize Application wizard.
Localize Application wizard confirmation of completion
You verify the translation results by changing the Locale Settings in your application.
- Change the browser locale setting to German to see the warning message in German.
- From the
User Interface landing page, Tools, Locale Settings
landing page, click .
- In Locale Settings, the Use Locale field, select Deutsch.
Locale Settings, Use Locale Deutsch
- From the
- Run the flow to see the warning message in context when you close the survey.
Warning message translated to German
In this example, the browser locale is set to English and the PRPC application locale is set to German. The text of the Windows security dialog box remains in English, which is the locale set by the browser for this test case. The text of the warning message, however, displays the German translation of the English text for the PRPC application. When you and other users click the link directly in the application, you can see the entire message displayed in the language set for your locale in your browser.
- Repeat Steps 1 and 2 to test the translated warning message in another locale, for example, English or Hindi.
Test English locale setting
Test Hindi locale setting