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:

  1. Insert a new language
  2. Remove a language
  3. Import the Language document
  4. Export the Language document
  5. Enable document language
  6. Select initial language in Runtime mode
  7. Area to edit the words of each Language

Inserting a new language

  1. To insert a new language, in the top menu, click on the “Insert Language” button.
  1. 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.

  1. 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

  1. To manually add words, type each word on one line and press ENTER on your keyboard to enter a new word.

Adding words Automatically

  1. 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.
  1. 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

  1. 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.
  1. After translating, change the application language to the second language, save the document and start the Runtime.

Below is shown all translated texts.

Language Functions

  1. 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.

SetLanguage Function

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:
SVApplications.SetLanguage(“Portuguese”);

Second Button Script:
SVApplications.SetLanguage(“English”);

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.

GetLanguage Function

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.