a word about gettext() and xgettext

Nicolas Williams Nicolas.Williams at sun.com
Thu Feb 5 12:27:38 EST 2009

A note that might be useful.

When adding gettext() calls to extract messages for localization there
is a way to do it with minimal impact if there's an intermediate
function for logging errors (e.g., krb5_set_error_message()):

 - don't put the gettext() call in the code that calls functions like
   krb5_set_error_message() -- put it in those functions

 - use the GNU xgettext(1) with the --keyword[=WORD] and/or
   --flag=word:arg:flag options

   e.g., xgettext --flag=krb5_set_error_message:3:c-format ...

This can keep changes to a minimum.

Solaris Kerberos has gettext() calls all over the place because years
ago the option of using the GNU xgettext didn't exist (either because
GNU xgettext didn't exist/didn't have the necessary features/couldn't be
used in Solaris build processes a decade or so ago).  So it may be too
late for this, but even so, this is a useful trick to know about, and
one that I've used before to keep L10N diffs between OpenSSH and SunSSH
to a minimum (of course, large parts of SunSSH, mostly in the sshd side
of things, do differ from OpenSSH in ways that could not be smoothed
over so well, but that's another story).


More information about the krbdev mailing list