Loading...
 

Literals

Text constants in the ClassiX® system

In a ClassiX® application there are constant texts on two levels:

  1. in the basic system:
    - error messages and information texts output by the programme code of the DLLs.
    - Names of weekdays, months
    - Terms such as "calendar week", "quarter", ...
    - Names of units of measurement and currencies
  2. in the InstantView® code of the application

Different languages are selected via an index. The indices 0 (German) and 1 (English UK) are fixed.
Any other languages - from index 2 - are determined in the locales according to the needs of the users.

Important: when assigning the indices for the languages of different countries, keep to the sequence (0=German, 1=English (UK), 2=first further language, 3=second further language.
The locales determine at the start all languages known in the ClassiX® system, which and how many. The number can be limited with the method SetMaxLanguages of the SystemObject.


System text constants

The multilingual text constants of the basic system do not belong to the C++ programme code.
They are stored in the external file systemStrings.stg (formerly: cxstring.001) . systemStrings.stg belongs to the scope of delivery of the ClassiX system. It provides texts in German and English (BE).

The texts can be edited, adding more languages, see literalSystem.mod.

The systemStrings.stg remains unchanged. Changes and extensions are saved in the file customStrings.stg (formerly: cxstring.003) . This file is created during the first editing process. As soon as customStrings.stg exists, the basic system uses the texts there.

Text constants from the InstantView® code

For the text constants in the InstantView® code - a similar solution exists. The outsourcing of the multilingual texts to an external file appsWHLiterals.stg (formerly: cxstring-uc.002) is optional. Without the file appsWHLiterals .stg, the text constants are used as they are in the InstantView® code. If an appsWHLiterals.stg exists, the text constants in the InstantView® programme code are only keys that refer to the "real" text constant.

cxstring002.bmp (1001574 bytes)

In addition to greater flexibility - the choice and sequence of languages can be customised for different users - another advantage is that the InstantView® programme code is not burdened by extensive text constants.

The appsWHLiterals.stg does not necessarily have to be complete: if nothing is found for a constant from the programme text, the original constant is retained.

The order of the languages for text constants from InstantView® must match that for the texts base system of the base system.
The first 2 languages, German and English (UK) are fixed in exactly this order (index 0 and 1).
From index 2 onwards, further languages can be described in the locales (see CX_COUNTRY_LOCALE).
Once the order has been set, it can no longer be changed!

The most important function for controlling language behaviour is the InstantView function Language.

Literal Browser

This shows the programmatic means (see also Text Literal Browser for system messages and the Text Literal for the AppsWarehouse®) by which one can.

  • find all text constants in the InstantView® modules of the AppsWarehouse
  • build and edit the file appsWHLiterals.stg.

The modules of the AppsWarehaus are read in with the function ParseLib of the system object and then completely loaded with LoadExternalModule. The modules are inactive, i.e. they do not react to messages. But all functions of the classes CX_MODULE or CX_WIDGET can be called - thus the AppsWarehouse® is accessible to introspection by means of InstantView® (example code).

The function FindMLStrings of the class CX_MODULE searches the module for text literals. Text literals are

  • Titles of window objects (i.e. of all window objects that can have a title - window, button, menu items, ... - irrespective of whether this was specified in one or more languages).
  • Tooltip of a window object
  • Multiple string constants of the form T(text0, text1, ..., textn) in action lists and statement definitions.

Simple string constants are not text literals.

Text literals are represented by objects of the class CXI_TEXT_LITERAL (example code).

Systemliteraleditor En

Each object of the class CXI_TEXT_LITERAL (figure: upper list) has a collection of objects of the class CXI_LITERAL_USAGE (figure: lower list); this allows the context in which a particular text occurs to be tracked(example code).

The corresponding window can be called up for the window objects (example code).

The CXI_TEXT_LITERAL object also supports the editing of new texts (example code). The texts are stored in the file appsWHLiterals.stg in the current working directory (usually CX_ROOTDIR).

Attention: The changed texts have no influence on already loaded/parsed modules. In order for the changes to become visible in the ClassiX system, either the affected modules must be reloaded or the ClassiX system must be restarted.