GiD - The personal pre and post processor

_noop() special macro

There is another special _noop () macro, intended for uses like the following (originating from "gettext"):

It is used to mark a string that the string extractor program must extract from the source files, but the compiled code does not have to translate directly.

Example: You cannot translate with _ () the constant strings set at compile time:


Example:
Incorrect:

char a[]=_("some text"); //compilation error
printf("%s\n",a);


(It will give compilation error because _() is defined as the MsgcatMc function, if you have chosen #define MSGCAT_GID, instead the macro _noop () does nothing)
Correct:

char a[]=_noop("some text");
printf("%s\n",_(a));

Note that _(a) will not add to the database to translate the word "a" (which would be incorrect), because it is not enclosed in quotes.

This _noop () macro should not be used to mark the strings that explicitly do not want to be translated (#include "Trad.h", etc.), for this, if you wish, you would have to define another new macro, such as _no() .

COPYRIGHT © 2022 · GID · CIMNE