How to Support Multiple Languages User Interface in ATEasy

Knowledge Base Article # Q200321

Read Prior Article Read Next Article
Summary Article shows how to change the language for your ATEasy user interface (UI) by using an ATEasy DLL to implement different languages UI. The language of the user interface items such as forms can be changed dynamically while the application is running and based on a user selection. Once the language is selected the language User interface is loaded and used.

Introduction

This article shows how to create or convert an ATEasy application to support multiple languages user interface providing an application that is more accessible and localized to customers around the world.

Overview

The article provides an example showing how to implement language localization for the following UI elements:
  • Forms inducing controls, menus
  • User Messages, prompts and strings
  • Test Log, including Test Names, Task Names
The main components that were used to create the example provided are:
1. Three modules used in this example as a typical ATEasy application
a. Program module
b. System module
c. Driver module

2. An ATEasy DLL file for each language to hold the application user interface; 4 DLLs are provided:
a. LanguageUIEnglish.dll, LanguageUIHebrew.dll, LanguageUIGerman.dll, LanguageUIChinese.dll, etc.
b. These DLL files should contain the implementation of the User interface and language based resources.

3. Have a UIlib DLL such that the language DLLs have the same prototype as the UIlib DLL
a. Allows the DLLs to have the same inputs and outputs
b. Allows the program to call in the language DLLs through the UIlib DLL

4. The UI driver can be included with the UIlib library and all of that should be placed inside the system module.

Background

There are two different ways that you can make a multiple language user interface. The first is by replacing the text fields in your form dynamically for each language. However, problems can occur with the font, size, and alignment of the text since each language's text has different attributes. As you can see, the first option can give you many problems, which brings us to the second option. The second option is to make multiple copies of the application in ATEasy DLL files (one file for each language), then calling in the appropriate DLL so it opens up the proper user interface. Implementing DLL files with user interface procedures instead of just replacing the text allows you to more accurately scale the user interface for each language. For this reason, in this article we will be showing you a step by step process of how to complete option two (creating ATEasy DLL files).

Every DLL will have the same DLL interface such that they have the same string functions but the user interface will look different, as seen in figures 1, 2, 3, and 4 below.

Chinese log changes
Figure 1. Translating test log output to Chinese

Chinese log output with changes
Figure 2. Chinese UI form

German log changes
Figure 3. Translating test log output to German

German log output with changes
Figure 4. German UI form

When the program figures out the desired language, it can simply load the proper DLL through LoadLibrary(UILib, “DLL path”). Using DLL files also allows you to have code in a driver and all the DLLs in that driver that can use that code which helps maximize reusable code.

Step by Step Process

1. Create a new driver
a. Name it UI
b. Create the driver that will have all of the DLLs in it

2. Go to events in the UI driver
Step 2
Figure 5


3. In UI driver create a new form
a. Name it SelectLanguage
b. Gives the user the opportunity to choose which language they want to be displayed

4. In SelectLanguage select the OnLoad() event
Step 4
Figure 6


5. In SelectLanguage select the OnClick() event
a. By clicking the language, it will call in the proper language DLL
Step 5
Figure 7:
A- ALabel - name: lblInstructions
B- AComboBox - name: cbSelectLanguage
C- AButton - name: btnOk


6. Go to UI events to OnInitProgram()
Step 6
Figure 8


7. Go to UI events to OnInitTask()
Step 7
Figure 9


8. Go to UI events to OnInitTest()
Step 8
Figure 10


9. Go to your program file and create a new test
a. Name it Display Form
Step 9
Figure 11


10. Go to UI Procedures and create a new procedure
a. Name it LoadMainForm
b. This procedure is in all the language DLLs too, so by calling in this procedure, the program reads in the UILib DLL and transfers you to the proper DLL file
Step 10
Figure 12


11. Go to Driver commands and connect procedure LoadMainForm to the commands
a. In ATEasy, when you create a new procedure, it is not a public procedure so by making this procedure into a command you are allowing the entire project to see and use this command. Essentially, you are converting the procedure from a private to a public procedure.

12. Go to UI events to OnEndProgram()
Step 12
Figure 13


13. Create a new project
a. Name it LanguageUIChinese or whatever language DLL you are making

14. In LanguageUIChinese make a new form
a. Name it MainForm
Step 14
Figure 14


15. In LanguageUIChinese make a new procedure
a. Name it LoadMainForm
Step 15
Figure 15


16. In LanguageUIChinese make a new procedure
a. Name it GetTaskTestName
Step 16
Figure 16


17. In LanguageUIChinese make a new procedure
a. Name it TranslateLogString_OnInit
Step 17
Figure 17


18. In LanguageUIChinese make a new procedure
a. Name it TranslateLogString_OnInitProgram
Step 18
Figure 18


19. In LanguageUIChinese make a new procedure
a. Name it TranslateLogString_OnInitTask
Step 19
Figure 19


20. In LanguageUIChinese make a new procedure
a. Name it TranslateLogString_OnEndProgram
Step 20
Figure 20


Summary

Introducing a new multiple language user interface in ATEasy increases the availability of an application to more users. Implementing a multiple language user interface through DLL files allows for a more accurate user interface than just changing the text to a different language. Using DLL files allows users to dynamically load the appropriate files during run time which is a response to the increasing trend of making applications more accessible.

Example Files

ATEasy example project files used in this article:
Article Date 9/2/2020 , 9/14/2020
Keywords ATEasy, Language, DLL

0 ratings | 0 out of 5
Read Prior Article Read Next Article