<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
- <meta content="text/html; charset=UTF-8" http-equiv="content-type">
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>GNU gettext FAQ</title>
</head>
<body>
</ul>
<h3>Problems integrating GNU gettext</h3>
<ul>
+ <li><a href="#integrating_howto">How do I make use of <span
+ style="font-family: monospace;">gettext()</span> in my package?</a></li>
<li><a href="#integrating_undefined">I get a linker error “undefined
reference to libintl_gettext”</a></li>
<li><a href="#integrating_abuse_gettextize">gettextize adds multiple
style="font-family: monospace;">DESTDIR</span> fails, it's a bug which
you are welcome to report to the usual bug report address.
<h3>Problems integrating GNU gettext</h3>
+<h4><a name="integrating_howto"></a>How do I make use of <span
+ style="font-family: monospace;">gettext()</span> in my package?</h4>
+It's not as difficult as it sounds. Here's the recipe for C or C++
+based packages.<br>
+<ul>
+ <li>Add an invocation of <span style="font-family: monospace;">AM_GNU_GETTEXT([external])</span>
+to the package's <span style="font-family: monospace;">configure.{ac,in}</span>
+file.</li>
+ <li>Invoke “<span style="font-family: monospace;">gettextize --copy</span>”.
+It will do most of the autoconf/automake related work for you.</li>
+ <li>Add the <span style="font-family: monospace;">gettext.h</span>
+file to the package's source directory, and include it in all source
+files that contain translatable strings or do output via <span
+ style="font-family: monospace;">printf</span> or <span
+ style="font-family: monospace;">fprintf</span>.</li>
+ <li>In the source file defining the main() function of the program,
+add these lines to the header<br>
+ <div style="margin-left: 40px;"><code><span
+ style="font-family: monospace;">#include <locale.h></span><br
+ style="font-family: monospace;">
+ <span style="font-family: monospace;">#include "gettext.h"</span></code><br>
+ </div>
+and these lines near the beginning of the main() function:<br>
+ <div style="margin-left: 40px;"><code><span
+ style="font-family: monospace;">setlocale (LC_ALL, "");</span><br
+ style="font-family: monospace;">
+ <span style="font-family: monospace;">bindtextdomain (PACKAGE,
+LOCALEDIR);</span><br style="font-family: monospace;">
+ <span style="font-family: monospace;">textdomain (PACKAGE);</span></code><br>
+ </div>
+ </li>
+ <li>Mark all strings that should be translated with _(), like this: <span
+ style="font-family: monospace;">_("No errors found.")</span>. 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.</li>
+ <li>In the freshly created <span style="font-family: monospace;">po/</span>
+directory, set up the <span style="font-family: monospace;">POTFILES.in</span>
+file, and do a “<span style="font-family: monospace;">make update-po</span>”.
+Then distribute the generated <span style="font-family: monospace;">.pot</span>
+file to your nearest translation project.</li>
+ <li>Shortly before a release, integrate the translators' <span
+ style="font-family: monospace;">.po</span> files into the <span
+ style="font-family: monospace;">po/</span> directory and do “<span
+ style="font-family: monospace;">make update-po</span>” again.<br>
+ </li>
+</ul>
+You find detailed descriptions of how this all works in the GNU gettext
+manual, chapters “The Maintainer's View” and “Preparing Program
+Sources”.
<h4><a name="integrating_undefined"></a>I get a linker error “undefined
reference to libintl_gettext”</h4>
This error means that the program uses the <span
<hr style="width: 100%; height: 2px;">
<address>GNU gettext FAQ<br>
Bruno Haible <<a href="mailto:bruno@clisp.org">bruno@clisp.org</a>></address>
-<p>Last modified: 22 February 2004
+<p>Last modified: 24 February 2004
</p>
</body>
</html>