DFRM tutorial

Example 3: several languages in a GEM application (without resource file)

by Dominique Béréziat

The file lang.c shows how to have several languages in a GEM application. The technique is very simple: an ASCII file contains strings, it is the language file. Each line begins with an unique alphanumerical identificator followed by the string. From this file, the dfrmstr utility builds a C-header file containing the definition of the identificators. As DFRM builds dynamically dialog box, it is possible to read one or several language file, and get from this file the required strings using the unique identificator provided by the C-header generated by dfrmstr.

In this example, the makefile lang.mak builds the lang.h file from the english language file lang.en using dfrmstr. lang.fr is the french version of lang.en. The program lang.c includes lang.h, loads the good language file, and stores all strings in a global array strs which can be accessed easily using indices defined in lang.h.

Dominique Béréziat