Hello and welcome to a new guide on how to best use Movicon.NExT™.
In this technote we are going to show you how to change languages while the project is running.
Movicon.NExT offers the possibility to change the project’s language
at runtime by configuring a graphical object, such as a button, with
the Change Language command.
After having configured the languages, you wish to use, and translated
the texts manually or automatically in the Texts Resource, you can
then proceed with configuring a button to change the language with.
When clicking this button at runtime, the project will automatically
translate into the language selected.
Now, we will create an example to show you how to do this.
This example involves a screen with text to be translated into other
languages. The language used by the screen text will then be changed
while the project is running by using buttons configured with the
Change Language command.
Start the Movicon.NExT platform up in design mode and create, or load,
a project.
First create a screen in this way:
Now that you have created the screen, change the project’s properties by inserting the screen we have just created as the project’s startup screen. To do this:
Once you have finished, click on the Save button on the toolbar to save the project.
Check that the Main screen is open, click on the Toolbox tab on
the far right next to the properties window to open the Toolbox library
offered by Movicon.NExT.
Select the Text Box object from the Texts folder and drag and drop
it on the screen. Select the object, open its properties window, then
go to the Text property and insert the “Home” string.
Now, we shall configure the languages and translations of the text
associated to the graphical object.
Double-click on String Resource located in the project tree to open
it.
After the Texts table has opened add two languages, for example English
(United States) and Italian, in this way:
Once both languages have been added, you can import the project
strings by clicking the Import Strings button on the Movicon.NExT
editor’s toolbar, or by selecting the Add String ID option from the
Options menu.
When the project’s texts have been imported, check that the Enable
Auto Translate option is deactivated in the contextual menu.
Now insert the “Home” string in the column that corresponds to the
English (United States) language, and the “Casa” string in the column
that corresponds to the Italian language.
Open the Main screen and then open the Toolbox library again. Go
to the Buttons folder and then the Standard folder and drag and drop
a Standard Metro Style button on the screen.
With the button selected, open it properties window and enter the ENG
string in the Text property field.
Still with the ENG button selected, click on the Commands tab at the
bottom of the editor.
Open the commands panel and select to add the Languages command to
the button’s associated command list.
Configure the command in the tab’s far right by selecting the en-US
option in the Language (Culture Name) property field.
Make a duplicate of the ENG button by using the copy and paste operations
with the Ctrl+C and Ctrl+V keys. Move the new button by dragging it
to new position within the screen so that it does not overlap the
other one.
With the new button selected, open its properties window. Go to the
Text property and change the string from ENG to ITA.
With the ITA button still selected, click on the Commands tab at the
bottom of the editor.
Open the Commands panel, configure the command on the tab’s far right
by selecting the it-IT option in the Language (Culture Name) property.
Save the project by clicking on the Save All icon on the Movicon.NExT editor’s Toolbar and start runtime.
As soon as the application starts running, the Main screen will
show with the graphical text object showing the Home string.
When clicking on the ITA button, the Home text will translate to Casa
by changing from English (United States) to Italian.
When clicking on the ENG button, the Casa string will translate to
Home by changing from Italian to English (United States).