1- <!-- $Header: /cvsroot/pgsql/doc/src/sgml/nls.sgml,v 1.5 2002/10/30 05:14:32 momjian Exp $ -->
1+ <!--
2+ $Header: /cvsroot/pgsql/doc/src/sgml/nls.sgml,v 1.6 2003/05/19 21:38:23 tgl Exp $
3+ -->
24
35<chapter id="nls">
46 <docinfo>
@@ -241,20 +243,20 @@ gmake update-po
241243
242244 <listitem>
243245 <para>
244- If the original is a printf format string, the translation also
245- needs to be. The translation also needs to have the same
246+ If the original is a<function> printf</> format string, the translation
247+ also needs to be. The translation also needs to have the same
246248 format specifiers in the same order. Sometimes the natural
247249 rules of the language make this impossible or at least awkward.
248- Inthis case you canuse this format:
250+ Inthat case you canmodify the format specifiers like this :
249251<programlisting>
250252msgstr "Die Datei %2$s hat %1$u Zeichen."
251253</programlisting>
252254 Then the first placeholder will actually use the second
253255 argument from the list. The
254256 <literal><replaceable>digits</replaceable>$</literal> needs to
255- follow the %and come before any other format manipulators.
257+ follow the %immediately, before any other format manipulators.
256258 (This feature really exists in the <function>printf</function>
257- family of functions. You may not have heard of it because
259+ family of functions. You may not have heard of itbefore because
258260 there is little use for it outside of message
259261 internationalization.)
260262 </para>
@@ -279,6 +281,7 @@ msgstr "Die Datei %2$s hat %1$u Zeichen."
279281 open file %s</literal>) should probably not start with a
280282 capital letter (if your language distinguishes letter case) or
281283 end with a period (if your language uses punctuation marks).
284+ It may help to read <xref linkend="error-style-guide">.
282285 </para>
283286 </listitem>
284287
@@ -301,8 +304,11 @@ msgstr "Die Datei %2$s hat %1$u Zeichen."
301304 <sect1 id="nls-programmer">
302305 <title>For the Programmer</title>
303306
307+ <sect2 id="nls-mechanics">
308+ <title>Mechanics</title>
309+
304310 <para>
305- This section describes how tosupport native language support in a
311+ This section describes how toimplement native language support in a
306312 program or library that is part of the
307313 <productname>PostgreSQL</> distribution.
308314 Currently, it only applies to C programs.
@@ -348,15 +354,15 @@ fprintf(stderr, gettext("panic level %d\n"), lvl);
348354 </para>
349355
350356 <para>
351- This may tend to add a lot of clutter. One common shortcut is to
357+ This may tend to add a lot of clutter. One common shortcut is to use
352358<programlisting>
353- #define _(x) gettext((x) )
359+ #define _(x) gettext(x )
354360</programlisting>
355361 Another solution is feasible if the program does much of its
356362 communication through one or a few functions, such as
357- <function>elog ()</function> in the backend. Then you make this
363+ <function>ereport ()</function> in the backend. Then you make this
358364 function call <function>gettext</function> internally on all
359- inputvalues .
365+ inputstrings .
360366 </para>
361367 </step>
362368
@@ -430,19 +436,29 @@ fprintf(stderr, gettext("panic level %d\n"), lvl);
430436 The build system will automatically take care of building and
431437 installing the message catalogs.
432438 </para>
439+ </sect2>
440+
441+ <sect2 id="nls-guidelines">
442+ <title>Message-writing guidelines</title>
433443
434444 <para>
435- To ease the translation of messages, here are some guidelines:
445+ Here are some guidelines for writing messages that are easily
446+ translatable.
436447
437448 <itemizedlist>
438449 <listitem>
439450 <para>
440- Do not construct sentences at run-time out of laziness , like
451+ Do not construct sentences at run-time, like
441452<programlisting>
442- printf("Fileswhere %s.\n", flag ? "copied" : "removed");
453+ printf("Fileswere %s.\n", flag ? "copied" : "removed");
443454</programlisting>
444455 The word order within the sentence may be different in other
445- languages.
456+ languages. Also, even if you remember to call gettext() on each
457+ fragment, the fragments may not translate well separately. It's
458+ better to duplicate a little code so that each message to be
459+ translated is a coherent whole. Only numbers, file names, and
460+ such-like run-time variables should be inserted at runtime into
461+ a message text.
446462 </para>
447463 </listitem>
448464
462478</programlisting>
463479 then be disappointed. Some languages have more than two forms,
464480 with some peculiar rules. We may have a solution for this in
465- the future, but for nowthis is best avoided altogether. You
466- could write:
481+ the future, but for nowthe matter is best avoided altogether.
482+ You could write:
467483<programlisting>
468484printf("number of copied files: %d", n);
469485</programlisting>
@@ -485,6 +501,7 @@ printf("number of copied files: %d", n);
485501 </listitem>
486502 </itemizedlist>
487503 </para>
504+ </sect2>
488505 </sect1>
489506
490507</chapter>