]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
One more question.
authorBruno Haible <bruno@clisp.org>
Tue, 24 Feb 2004 21:33:56 +0000 (21:33 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:11:49 +0000 (12:11 +0200)
gettext-tools/doc/ChangeLog
gettext-tools/doc/FAQ.html

index 7e5e1d49e82edfdaf4f69c89a723cb8e81424922..3b8050990845bc211a3d8692d683f9729b9555e4 100644 (file)
@@ -1,3 +1,8 @@
+2004-02-24  Bruno Haible  <bruno@clisp.org>
+
+       * FAQ.html (How do I make use of gettext() in my package?): New
+       question. Suggested by Paul Eggert <eggert@cs.ucla.edu>.
+
 2004-02-21  Bruno Haible  <bruno@clisp.org>
 
        * FAQ.html: New file.
index a8206ceaef50e87428355e7321cca971f8a13c84..49b86a629f0c5d18d20b980133391e3ed6dc73cb 100644 (file)
@@ -1,7 +1,7 @@
 <!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>
@@ -29,6 +29,8 @@ fail: “ld: fatal error ... -lrpathz”</a></li>
 </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
@@ -189,6 +191,57 @@ If “<span style="font-family: monospace;">make install</span>” without <span
  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 &lt;locale.h&gt;</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
@@ -798,7 +851,7 @@ converts all string literals to UTF-8.</li>
 <hr style="width: 100%; height: 2px;">
 <address>GNU gettext FAQ<br>
 Bruno Haible &lt;<a href="mailto:bruno@clisp.org">bruno@clisp.org</a>&gt;</address>
-<p>Last modified: 22 February 2004
+<p>Last modified: 24 February 2004
 </p>
 </body>
 </html>