How to use Language Document
Purpose of this article
This article aims to show what is and how to use the Language document.
What is Document Language
Languages Documents allows you to internationalize an application, creating dictionary tables, in which each table corresponds to a language, and each row of the table contains words that will be translated into another language.
Languages Document is located in the navigation tree. To create a new Languages Document, follow the steps below:
- Click on the Language document and then right-click on “Languages”.
- Then click on the “Open Language” option.
- A new document will be shown:
Languages Document has the following features:
- Insert a new language
- Remove a language
- Import the Language document
- Export the Language document
- Enable document language
- Select initial language in Runtime mode
- Area to edit the words of each Language
Inserting a new language
- To insert a new language, in the top menu, click on the “Insert Language” button.
- A window will ask for the name of the new language.
Note that after inserting the new language, a new column was inserted in the editing area, which will contain all the words of this language.
- After creating the first language, it is necessary to save and enable the document. Then select the language in which to start in runtime mode.
Populating the language table
The table for each language needs to be filled with words into which they will be translated. You can add words manually or automatically.
Adding words manually
- To manually add words, type each word on one line and press ENTER on your keyboard to enter a new word.
Adding words Automatically
- To automatically add words, ADISRA SmartView will search for all words entered in the “Text” property of all screen objects and fill the main column with the words found.
In the example below, five label objects were inserted.
- After saving the “Graphics1” screen, the text of each object was sent to the main language column of the “Language” document.
Adding the second language
- After filling in the column for the main language, that is, the language in English as shown in the example shown, in the upper left menu, click on the “Insert Language” button and then fill each line with the word that represents the second language.
- After translating, change the application language to the second language, save the document and start the Runtime.
Below is shown all translated texts.
- ADISRA SmartView provides two language functions, the “SetLanguage()” function, which is used to change the application language in runtime mode, and the “GetLanguage()” function, which returns the current application language.
To use the “SetLanguage()” function, insert two buttons on a screen, and in the mouseup event of each button, insert the following script:
First Button Script:
Second Button Script:
From now on, by clicking on the buttons, it is possible to change the main language of the application between English and Portuguese.
Note: It is necessary to close the current application screen for the language to be changed. For example, closing the screen or navigating between screens to make the change.
To use the “GetLanguage()” function, create a string type tag, insert a TextBox object on the screen, associate the created tag in the “Text” property of the TextBox object and then insert the script below in the “On Open” event of the screen.
@Language = SVApplications.GetLanguage();
From now on, whenever the screen is opened, the script will be executed, assigning the application’s current language to the “Language” tag and the value of this tag will be shown in the TextBox object.