Project members: Language

With this definition you can determine all languages available for the localization of your application. For example, if the end-user should be able to switch the GUI between English, German and Spanish you will need three corresponding language members in your project. Language members are represented in Composer by following bricks:

Please note, language members can exist only at the root level of the project.

Add new language

First switch to the Composer containing the project main page.

Then, in the Gallery window, ensure that the folder Chora is opened.

Look in the folder for the template named Language.

With the mouse, select the template and drag it into the Composer.

Drop the template within the Composer.

Adding a new language member.

Name the language

First ensure, that the language member is selected.

Press the key F2 or select the menu item EDITRename ....

Enter the new language name in the Inspector window.

The assigned name identifies globally the language within your project. Once defined, the language appears in the attributes of all constant, bitmap and font resource members allowing every member being localized individually.

TIP

Please note the particular language name Default. It represents the so-called fallback language variant to use wherever a constant or resource hasn't any localized value for the currently selected language. It is obligatory for every Embedded Wizard project to contain one language member with the name Default.

Duplicate an existing language

You can create any number of copies of an already existing language member.

First ensure, that the language member is selected.

Press the keys CtrlC and CtrlV in succession ...

... or hold the key Ctrl pressed while you drag and drop the selected language member.

Finally rename the just duplicated language member.

Localize constants and resources

Once defined a language member, its name appears automatically in the Inspector window in the attributes list of every constant, bitmap and font resource member. Accordingly, you can configure the member with multiple, localized values. The appropriate value is selected automatically in respect to the language currently stored in the global variable language. Please note, if there is no localized value specified for an attribute, Embedded Wizard uses automatically the value of the fallback language Default.

Use the language in expressions

The name of the language member can be used within Chora expressions wherever an operand with the data type language is expected. In particular, the language names are used in conjunction with the global variable language to control the currently selected language at the runtime. For example:

// Activate the style with the name 'HiRes'
language = French;

Select the current language

At the design and prototyping time the language can be selected conveniently by using the language selection combobox. This selection has however no effect on the generated code. To determine the language at the runtime, use the global variable language.

Control the code generation

With the attribute Generator you can selectively control, whether the localized values for the language specified in all constants and resources should be taken in account during the code generation or not. Configuring this attribute with the value false will exclude the language from your project unless the language name is explicitly involved within a Chora expression.

Delete a language

First ensure, that the language member is selected.

Press the key DEL or select the menu item EDITDelete.

Attributes of a language

The following table shows the complete list of attributes provided by the language member:

Attribute name

Short description

Brick

Determines the position and the size of a language member brick within the Composer window.

Description

Contains the description for the language member.

Generator

Controls the code generation for the affected language member.