Setting the project's language during runtime

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

This procedure assumes that you have already added at least one target language to the Translation Table. For more information, see Adding a language.

The SetLanguage function takes one parameter: a numeric code representing the target language. The codes are shown in parentheses in the list of languages — for example, English-United States is 1033.

The following very basic 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).

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

  11. Save and close the project screen.
During project runtime, clicking each button will set the language of the entire project to that language, using the translated text from the Translation Table.