<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../general.ent">
  %general-entities;
]>

<sect1 id="ch-system-gettext" role="wrap">
  <?dbhtml filename="gettext.html"?>

  <sect1info condition="script">
    <productname>gettext</productname>
    <productnumber>&gettext-version;</productnumber>
    <address>&gettext-url;</address>
  </sect1info>

  <title>Gettext-&gettext-version;</title>

  <indexterm zone="ch-system-gettext">
    <primary sortas="a-Gettext">Gettext</primary>
  </indexterm>

  <sect2 role="package">
    <title/>

    <!--para>The Gettext package contains utilities for internationalization and
    localization. These allow programs to be compiled with NLS (Native Language
    Support), enabling them to output messages in the user's native
    language.</para-->
    <para>Gettext 软件包包含国际化和本地化工具，
		它们允许程序在编译时加入 NLS （母语支持）功能，
		使它们能够以用户的母语输出消息。</para>

    <segmentedlist>
      <segtitle>&buildtime;</segtitle>
      <segtitle>&diskspace;</segtitle>

      <seglistitem>
        <seg>&gettext-ch6-sbu;</seg>
        <seg>&gettext-ch6-du;</seg>
      </seglistitem>
    </segmentedlist>

  </sect2>

  <sect2 role="installation">
    <title>安装 Gettext</title>

   <!-- This has been fixed in upstream gnulib, when a new version of
   gettext is released, please check #4055 to see if the change has been
   picked up in this package 
   
   As of April 11, 2018, 'TESTS = test-lock' is in gettext-runtime/tests/Makefile.am
   Perhaps the test is fixed.

   There is no reference to 'test' or TEST in  gettext-tools/gnulib-tests/Makefile.am
   -->
   <para>首先，取消 test-lock 的两次执行，因为它在某些机器上会死循环：
   </para>

<screen><userinput remap="pre">sed -i '/^TESTS =/d' gettext-runtime/tests/Makefile.in &amp;&amp;
sed -i 's/test-lock..EXEEXT.//' gettext-tools/gnulib-tests/Makefile.in</userinput></screen>

   <!-- As of April 11, 2018 appdata.* is NOT in git master, but appears
   to be in metainfo.{its,loc},  When updating, check BLFS gnome-screenshot. -->
   <para>现在修复一个配置文件：</para>

<screen><userinput remap="pre">sed -e '/AppData/{N;N;p;s/\.appdata\./.metainfo./}' \
    -i gettext-tools/its/appdata.loc</userinput></screen>

    <para>准备编译 Gettext：</para>

<screen><userinput remap="configure">./configure --prefix=/usr    \
            --disable-static \
            --docdir=/usr/share/doc/gettext-&gettext-version;</userinput></screen>

    <para>编译该软件包：</para>

<screen><userinput remap="make">make</userinput></screen>

    <para>输入以下命令以测试编译结果（需要较长时间, 大约 3 SBU）：</para>

<screen><userinput remap="test">make check</userinput></screen>

    <para>安装该软件包：</para>

<screen><userinput remap="install">make install
chmod -v 0755 /usr/lib/preloadable_libintl.so</userinput></screen>

  </sect2>

  <sect2 id="contents-gettext" role="content">
    <title>Gettext 的内容</title>

    <segmentedlist>
      <segtitle>安装的程序</segtitle>
      <segtitle>安装的库</segtitle>
      <segtitle>安装的目录</segtitle>

      <seglistitem>
        <seg>autopoint, envsubst, gettext, gettext.sh,
        gettextize, msgattrib, msgcat, msgcmp, msgcomm, msgconv, msgen,
        msgexec, msgfilter, msgfmt, msggrep, msginit, msgmerge, msgunfmt, msguniq,
        ngettext, recode-sr-latin, 以及 xgettext</seg>
        <seg>libasprintf.so, libgettextlib.so, libgettextpo.so,
        libgettextsrc.so, 以及 preloadable_libintl.so</seg>
        <seg>/usr/lib/gettext, /usr/share/doc/gettext-&gettext-version;, 以及
        /usr/share/gettext</seg>
      </seglistitem>
    </segmentedlist>

    <variablelist>
      <bridgehead renderas="sect3">简要描述</bridgehead>
      <?dbfo list-presentation="list"?>
      <?dbhtml list-presentation="table"?>

      <varlistentry id="autopoint">
        <term><command>autopoint</command></term>
        <listitem>
          <para>将标准 Gettext 微架构文件复制到源代码包</para>
          <indexterm zone="ch-system-gettext autopoint">
            <primary sortas="b-autopoint">autopoint</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="envsubst">
        <term><command>envsubst</command></term>
        <listitem>
          <para>替换 shell 格式化字符串中的环境变量</para>
          <indexterm zone="ch-system-gettext envsubst">
            <primary sortas="b-envsubst">envsubst</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="gettext">
        <term><command>gettext</command></term>
        <listitem>
          <para>通过查询消息目录中的翻译，将中性语言消息翻译成用户的语言
          </para>
          <indexterm zone="ch-system-gettext gettext">
            <primary sortas="b-gettext">gettext</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="gettext.sh">
        <term><command>gettext.sh</command></term>
        <listitem>
          <para>主要用于 gettext 的 shell 函数库</para>
          <indexterm zone="ch-system-gettext gettext.sh">
            <primary sortas="b-gettext.sh">gettext.sh</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="gettextize">
        <term><command>gettextize</command></term>
        <listitem>
          <para>将所有标准 Gettext 文件复制到软件包顶层目录中，
          以开始国际化该软件包</para>
          <indexterm zone="ch-system-gettext gettextize">
            <primary sortas="b-gettextize">gettextize</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="msgattrib">
        <term><command>msgattrib</command></term>
        <listitem>
          <para>根据属性过滤翻译目录中的消息，或修改这些属性</para>
          <indexterm zone="ch-system-gettext msgattrib">
            <primary sortas="b-msgattrib">msgattrib</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="msgcat">
        <term><command>msgcat</command></term>
        <listitem>
          <para>连接并合并给定的
          <filename class="extension">.po</filename> 文件</para>
          <indexterm zone="ch-system-gettext msgcat">
            <primary sortas="b-msgcat">msgcat</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="msgcmp">
        <term><command>msgcmp</command></term>
        <listitem>
          <para>比较两个 <filename class="extension">.po</filename>
          文件，以检查它们是否包含相同的 msgid 字符串集合</para>
          <indexterm zone="ch-system-gettext msgcmp">
            <primary sortas="b-msgcmp">msgcmp</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="msgcomm">
        <term><command>msgcomm</command></term>
        <listitem>
          <para>找出给定的多个
          <filename class="extension">.po</filename> 中的公共消息</para>
          <indexterm zone="ch-system-gettext msgcomm">
            <primary sortas="b-msgcomm">msgcomm</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="msgconv">
        <term><command>msgconv</command></term>
        <listitem>
          <para>将翻译目录转换成另一种字符编码</para>
          <indexterm zone="ch-system-gettext msgconv">
            <primary sortas="b-msgconv">msgconv</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="msgen">
        <term><command>msgen</command></term>
        <listitem>
          <para>创建英文翻译目录</para>
          <indexterm zone="ch-system-gettext msgen">
            <primary sortas="b-msgen">msgen</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="msgexec">
        <term><command>msgexec</command></term>
        <listitem>
          <para>对翻译目录中的所有翻译执行命令</para>
          <indexterm zone="ch-system-gettext msgexec">
            <primary sortas="b-msgexec">msgexec</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="msgfilter">
        <term><command>msgfilter</command></term>
        <listitem>
          <para>对翻译目录中的所有翻译应用过滤器</para>
          <indexterm zone="ch-system-gettext msgfilter">
            <primary sortas="b-msgfilter">msgfilter</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="msgfmt">
        <term><command>msgfmt</command></term>
        <listitem>
          <para>根据翻译目录创建二进制消息目录</para>
          <indexterm zone="ch-system-gettext msgfmt">
            <primary sortas="b-msgfmt">msgfmt</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="msggrep">
        <term><command>msggrep</command></term>
        <listitem>
          <para>找出翻译目录中所有匹配给定模式，
          	  或属于给定源代码文件的消息</para>
          <indexterm zone="ch-system-gettext msggrep">
            <primary sortas="b-msggrep">msggrep</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="msginit">
        <term><command>msginit</command></term>
        <listitem>
          <para>创建一个新的 <filename class="extension">.po</filename>
			  文件，以用户环境中的值初始化其元信息</para>
          <indexterm zone="ch-system-gettext msginit">
            <primary sortas="b-msginit">msginit</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="msgmerge">
        <term><command>msgmerge</command></term>
        <listitem>
          <para>将两个原始翻译文件组合成一个文件</para>
          <indexterm zone="ch-system-gettext msgmerge">
            <primary sortas="b-msgmerge">msgmerge</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="msgunfmt">
        <term><command>msgunfmt</command></term>
        <listitem>
          <para>反编译二进制消息目录，生成原始翻译文本</para>
          <indexterm zone="ch-system-gettext msgunfmt">
            <primary sortas="b-msgunfmt">msgunfmt</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="msguniq">
        <term><command>msguniq</command></term>
        <listitem>
          <para>去除翻译目录中重复的翻译</para>
          <indexterm zone="ch-system-gettext msguniq">
            <primary sortas="b-msguniq">msguniq</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="ngettext">
        <term><command>ngettext</command></term>
        <listitem>
          <para>显示某条语法形式依赖于数字的文本消息的母语翻译</para>
          <indexterm zone="ch-system-gettext ngettext">
            <primary sortas="b-ngettext">ngettext</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="recode-sr-latin">
        <term><command>recode-sr-latin</command></term>
        <listitem>
          <para>将塞尔维亚语文本从西里尔字符转换为拉丁字符</para>
          <indexterm zone="ch-system-gettext recode-sr-latin">
            <primary sortas="b-recode-sr-latin">recode-sr-latin</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="xgettext">
        <term><command>xgettext</command></term>
        <listitem>
          <para>从给定源代码文件中提取可翻译消息，以生成最初的翻译模板
          </para>
          <indexterm zone="ch-system-gettext xgettext">
            <primary sortas="b-xgettext">xgettext</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="libasprintf">
        <term><filename class="libraryfile">libasprintf</filename></term>
        <listitem>
          <para>定义 <emphasis>autosprintf</emphasis> 类，使得
          C 格式化输出子程序在 C++ 程序中可用，能够与
          <emphasis>&lt;string&gt;</emphasis> 字符串和
          <emphasis>&lt;iostream&gt;</emphasis> 流一起使用</para>
          <indexterm zone="ch-system-gettext libasprintf">
            <primary sortas="c-libasprintf">libasprintf</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="libgettextlib">
        <term><filename class="libraryfile">libgettextlib</filename></term>
        <listitem>
          <para>一个内部库，包含若干 Gettext 程序的公共子程序；
          不建议普遍使用</para>
          <indexterm zone="ch-system-gettext libgettextlib">
            <primary sortas="c-libgettextlib">libgettextlib</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="libgettextpo">
        <term><filename class="libraryfile">libgettextpo</filename></term>
        <listitem>
          <para>用于编写处理
          <filename class="extension">.po</filename> 文件的专用程序；
          这个库在 Gettext 发行的标准程序 （如
          <command>msgcomm</command>, <command>msgcmp</command>,
          <command>msgattrib</command>, 以及 <command>msgen</command>）
          不能满足要求时使用</para>
          <indexterm zone="ch-system-gettext libgettextpo">
            <primary sortas="c-libgettextpo">libgettextpo</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="libgettextsrc">
        <term><filename class="libraryfile">libgettextsrc</filename></term>
        <listitem>
          <para>一个内部库，包含若干 Gettext 程序使用的公共子程序；
          没有设计为普遍使用</para>
          <indexterm zone="ch-system-gettext libgettextsrc">
            <primary sortas="c-libgettextsrc">libgettextsrc</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="preloadable_libintl">
        <term><filename class="libraryfile">preloadable_libintl</filename></term>
        <listitem>
          <para>一个被设计为由 LD_PRELOAD 预加载的库，帮助
          <filename class="libraryfile">libintl</filename>
          记录未翻译的消息</para>
          <indexterm zone="ch-system-gettext preloadable_libintl">
            <primary sortas="c-preloadable_libintl">preloadable_libintl</primary>
          </indexterm>
        </listitem>
      </varlistentry>
    </variablelist>

  </sect2>

</sect1>
