Model Languages - openmpp/openmpp.github.io GitHub Wiki
Home > Model Development Topics > Model Languages
The human languages supported by a model.
This topic is under construction and/or revision.
- Authored Model Documentation: The autonomous authored component of model documentation
- Generated Model Documentation: The symbol reference component of model documentation
- Model Symbols: Symbols in model code and in the user interface
- Symbol Labels and Notes: Human-language labels and notes for model symbols
Content to follow.
Each human language supported by a model has an associated language code given
in the languages
statement of the model.
A model is required to have a languages
statement which declares at least one language.
For example,
languages
{
EN, // English
FR // Français
};
declares two languages EN
and FR
.
These codes can be used in model code
to provide language-specific documentation of model symbols.
OpenM++ imposes no limitations on language codes,
but it is strongly recommended to use the two-letter prefix of standard locale codes,
as in the example above.
Using upper case language codes helps them stand out in model code.
So, the suggested code for Spanish is ES
,
and for German DE
.
The OpenM++ UI renders model-independent text, e.g. the word Run
,
using a human-language specific library.
Libraries for EN
and FR
are currently available.
If there is no library for a language specified in a model,
the UI will display model-specific content in that language,
but will fall back to one of the available libraries for model-independent text.
The first language listed in the languages
statement is the default language of the model,
which in this example is EN
.
The default language of the model is usually the language in which the source code is written,
i.e. the choice of symbol names and the language of explanatory code comments.
The language presented initially in the UI might not be the default language,
but instead the language of the locale on the end user's device.
An end user can switch languages dynamically in the UI.
The trailing comment after each language code provides a language-specific label for the language code declared previously in the line. The UI uses these labels to display human-language versions of the model's available languages when a user selects or changes the UI language.