Pick a Free OS

User login

Navigation

More about Motor

But turning the option `on' is not enough. You have to create at least one translation file so gettext stuff can be included into your project. For example, you want to translate it into Russian. You open the "Project files" dialog, and add a file named "po/ru.po" to the "Miscellaneous files" folder. As soon as the dialog is closed, all the necessary programs are run and two directories are created. They are standard--named po/ and intl/.

Being familiar with GNU gettext, you know that to make a program multi-lingual you need to add certain code to its source. Usually it's done in the following way:

// ...

#ifdef ENABLE_NLS

#include <libintl.h>

#include <locale.h>

#define     _(c)     gettext(c)

#endif

// ...

int main() {

   // ...

#ifdef ENABLE_NLS

   setlocale(LC_ALL, "");

   bindtextdomain("progname", "/usr/share/locale");

      // Actually the directory for translation files should

      // be specified in a more flexible way, but I left it

      // hard-coded just to keep things simple.

   textdomain("progname);

#endif

   // ...

}

Having done all of this you can now, easily, add .po's to the "Miscellaneous files" folder. If you use automake, they will be compiled and installed automatically.

The magic functional Makefile

It became obvious that previous versions of motor needed more flexibility. Growing amount of external GNU tools needed to be called, more complex scripts, etc. So, we though about how we could group them and came up with a simple solution, to add a template for Makefile that does everything. Its `Makefile.func' and is called to compile and clean the binaries and object files, import files into CVS, call a debugger, and to generate automake required Makefile.am files too.

The output of Makefile.func is displayed every time the execution is performed. Actually it's quite customizable. If you don't want to see all of those annoying and chaotic messages, you can easily turn it off with the appropriate options in the "Motor settings" dialog. Options for compiler and CVS output are separate and hence you can control both of them.