From: Bruno Haible Date: Tue, 24 Feb 2004 21:33:56 +0000 (+0000) Subject: One more question. X-Git-Tag: v0.14.2~284 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78ea9316114d036e76463f6d6ee233ef5e4e4c81;p=thirdparty%2Fgettext.git One more question. --- diff --git a/gettext-tools/doc/ChangeLog b/gettext-tools/doc/ChangeLog index 7e5e1d49e..3b8050990 100644 --- a/gettext-tools/doc/ChangeLog +++ b/gettext-tools/doc/ChangeLog @@ -1,3 +1,8 @@ +2004-02-24 Bruno Haible + + * FAQ.html (How do I make use of gettext() in my package?): New + question. Suggested by Paul Eggert . + 2004-02-21 Bruno Haible * FAQ.html: New file. diff --git a/gettext-tools/doc/FAQ.html b/gettext-tools/doc/FAQ.html index a8206ceae..49b86a629 100644 --- a/gettext-tools/doc/FAQ.html +++ b/gettext-tools/doc/FAQ.html @@ -1,7 +1,7 @@ - + GNU gettext FAQ @@ -29,6 +29,8 @@ fail: “ld: fatal error ... -lrpathz”

Problems integrating GNU gettext

    +
  • How do I make use of gettext() in my package?
  • I get a linker error “undefined reference to libintl_gettext”
  • gettextize adds multiple @@ -189,6 +191,57 @@ If “make install” without DESTDIR fails, it's a bug which you are welcome to report to the usual bug report address.

    Problems integrating GNU gettext

    +

    How do I make use of gettext() in my package?

    +It's not as difficult as it sounds. Here's the recipe for C or C++ +based packages.
    +
      +
    • Add an invocation of AM_GNU_GETTEXT([external]) +to the package's configure.{ac,in} +file.
    • +
    • Invoke “gettextize --copy”. +It will do most of the autoconf/automake related work for you.
    • +
    • Add the gettext.h +file to the package's source directory, and include it in all source +files that contain translatable strings or do output via printf or fprintf.
    • +
    • In the source file defining the main() function of the program, +add these lines to the header
      +
      #include <locale.h>
      + #include "gettext.h"

      +
      +and these lines near the beginning of the main() function:
      +
      setlocale (LC_ALL, "");
      + bindtextdomain (PACKAGE, +LOCALEDIR);
      + textdomain (PACKAGE);

      +
      +
    • +
    • Mark all strings that should be translated with _(), like this: _("No errors found."). While +doing this, try to turn the strings into good English, one entire +sentence per string, not more than one paragraph per string, and use +format strings instead of string concatenation. This is needed so that +the translators can provide accurate translations.
    • +
    • In the freshly created po/ +directory, set up the POTFILES.in +file, and do a “make update-po”. +Then distribute the generated .pot +file to your nearest translation project.
    • +
    • Shortly before a release, integrate the translators' .po files into the po/ directory and do “make update-po” again.
      +
    • +
    +You find detailed descriptions of how this all works in the GNU gettext +manual, chapters “The Maintainer's View” and “Preparing Program +Sources”.

    I get a linker error “undefined reference to libintl_gettext”

    This error means that the program uses the
    GNU gettext FAQ
    Bruno Haible <bruno@clisp.org>
    -

    Last modified: 22 February 2004 +

    Last modified: 24 February 2004