Set the project’s language during run time

You can set your project’s language during run time by using the function SetLanguage anywhere that an expression can be configured.

Before you begin this task, you must have already added at least one target language to the Translation Table worksheet. For more information, see Add a target language to the Translation Table.

The function SetLanguage takes one parameter: the Locale ID for the target language. The Locale ID for a language is shown in parentheses next to the language in the Translation Table worksheet — for example, “English-United States” is 1033.

Note: Locale IDs are the proprietary language/region codes used in Microsoft Windows. For more information, go to: msdn.microsoft.com/library/ms912047

The following example shows how to draw two Button objects that switch the project’s language between English and French:

  1. In the Graphics tab of the Project Explorer, double-click a project screen to open it for editing.
  2. On the Graphics tab of the ribbon, in the Active Objects group, click Button.
  3. Draw a Button object in the project screen.
  4. Double-click the Button object. The Object Properties dialog is displayed.
  5. In the Caption box, type English.
  6. Click Command. The Command animation properties are displayed in the dialog.
  7. In the first row of the On Down tab, in the Expression field, type SetLanguage(1033).
    Web Studio Help illus translation setlanguage 1 Set the projects language during run time

  8. Close the Object Properties dialog.
  9. Duplicate the Button object, either by copy-and-paste or by Ctrl+Click.
  10. Repeat steps 4 through 8, replacing the caption with French and the expression with SetLanguage(1036).
    Web Studio Help illus translation setlanguage 2 Set the projects language during run time

  11. Save and close the project screen.
During project run time, clicking each button will set the language of the entire project to that language, using the translated text from the Translation Table.
Note: Setting your project’s language will also automatically set the language of the Virtual Keyboard, as long as there is a keyboard configuration file for the selected language. Keyboard configuration files are stored at C:Program FilesInduSoft Web Studio v7.1BinVK**.ini, where ** is the two-letter language code.

You can directly set the language of the Virtual Keyboard, separate from the project’s language, by calling the function SetKeyboardLanguage during run time.

Set the project’s language during run time