[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.15 Internationalizing AutoOpts

The generated code for AutoOpts will enable and disable the translation of AutoOpts run time messages. If ENABLE_NLS is defined at compile time, then the _() macro may be used to specify a translation function. If undefined, it will default to gettext(3GNU). This define will also enable a callback function that optionProcess invokes at the beginning of option processing. The AutoOpts libopts library will always check for this "compiled with NLS" flag, so libopts does not need to be specially compiled. The strings returned by the translation function will be strdup(3)-ed and kept. They will not be re-translated, even if the locale changes, but they will also not be dependent upon reused or unmappable memory.

To internationalize option processing, you should first internationalize your program. Then, the option processing strings can be added to your translation text by processing the AutoOpts-generated `my-opts.c' file and adding the distributed `po/usage-txt.pot' file. (Also by extracting the strings yourself from the `usage-txt.h' file.) When you call optionProcess, all of the user visible AutoOpts strings will be passed through the localization procedure established with the _() preprocessing macro.


This document was generated by Bruce Korb on September, 30 2006 using texi2html 1.76.

Viewable With Any Browser   autogen Home