Home Explore Blog CI



postgresql

1st chunk of `doc/src/sgml/nls.sgml`
b1111e1d59d6a546f645fdbf00692dfa6acb3ed2bd8477bf0000000100000fa6
<!-- doc/src/sgml/nls.sgml -->

<chapter id="nls">
 <title>Native Language Support</title>

 <sect1 id="nls-translator">
  <title>For the Translator</title>

  <para>
   <productname>PostgreSQL</productname>
   programs (server and client) can issue their messages in
   your favorite language &mdash; if the messages have been translated.
   Creating and maintaining translated message sets needs the help of
   people who speak their own language well and want to contribute to
   the <productname>PostgreSQL</productname> effort.  You do not have to be a
   programmer at all
   to do this.  This section explains how to help.
  </para>

  <sect2 id="nls-translator-requirements">
   <title>Requirements</title>

   <para>
    We won't judge your language skills &mdash; this section is about
    software tools.  Theoretically, you only need a text editor.  But
    this is only in the unlikely event that you do not want to try out
    your translated messages.  When you configure your source tree, be
    sure to use the <option>--enable-nls</option> option.  This will
    also check for the <application>libintl</application> library and the
    <filename>msgfmt</filename> program, which all end users will need
    anyway.  To try out your work, follow the applicable portions of
    the installation instructions.
   </para>

   <para>
    If you want to start a new translation effort or want to do a
    message catalog merge (described later), you will need the
    programs <filename>xgettext</filename> and
    <filename>msgmerge</filename>, respectively, in a GNU-compatible
    implementation.  Later, we will try to arrange it so that if you
    use a packaged source distribution, you won't need
    <filename>xgettext</filename>.  (If working from Git, you will still need
    it.)  <application>GNU Gettext 0.10.36</application> or later is currently recommended.
   </para>

   <para>
    Your local gettext implementation should come with its own
    documentation.  Some of that is probably duplicated in what
    follows, but for additional details you should look there.
   </para>
  </sect2>

  <sect2 id="nls-translator-concepts">
   <title>Concepts</title>

   <para>
    The pairs of original (English) messages and their (possibly)
    translated equivalents are kept in <firstterm>message
    catalogs</firstterm>, one for each program (although related
    programs can share a message catalog) and for each target
    language.  There are two file formats for message catalogs:  The
    first is the <quote>PO</quote> file (for Portable Object), which
    is a plain text file with special syntax that translators edit.
    The second is the <quote>MO</quote> file (for Machine Object),
    which is a binary file generated from the respective PO file and
    is used while the internationalized program is run.  Translators
    do not deal with MO files; in fact hardly anyone does.
   </para>

   <para>
    The extension of the message catalog file is to no surprise either
    <filename>.po</filename> or <filename>.mo</filename>.  The base
    name is either the name of the program it accompanies, or the
    language the file is for, depending on the situation.  This is a
    bit confusing.  Examples are <filename>psql.po</filename> (PO file
    for psql) or <filename>fr.mo</filename> (MO file in French).
   </para>

   <para>
    The file format of the PO files is illustrated here:
<programlisting>
# comment

msgid "original string"
msgstr "translated string"

msgid "more original"
msgstr "another translated"
"string can be broken up like this"

...
</programlisting>
    The msgid lines are extracted from the program source.  (They need not
    be, but this is the most common way.)  The msgstr lines are
    initially empty and are filled in with useful strings by the
    translator.  The strings can contain C-style escape characters and
    can be continued across lines as illustrated.  (The next line must
    start at the beginning of the line.)

Title: Native Language Support for PostgreSQL
Summary
This section explains how translators can contribute to the PostgreSQL effort by creating and maintaining translated message sets, including the requirements and concepts needed to get started with translating PostgreSQL programs into their native language.