gettext.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  4. <!ENTITY % general-entities SYSTEM "../general.ent">
  5. %general-entities;
  6. ]>
  7. <sect1 id="ch-system-gettext" role="wrap">
  8. <?dbhtml filename="gettext.html"?>
  9. <sect1info condition="script">
  10. <productname>gettext</productname>
  11. <productnumber>&gettext-version;</productnumber>
  12. <address>&gettext-url;</address>
  13. </sect1info>
  14. <title>Gettext-&gettext-version;</title>
  15. <indexterm zone="ch-system-gettext">
  16. <primary sortas="a-Gettext">Gettext</primary>
  17. </indexterm>
  18. <sect2 role="package">
  19. <title/>
  20. <!--para>The Gettext package contains utilities for internationalization and
  21. localization. These allow programs to be compiled with NLS (Native Language
  22. Support), enabling them to output messages in the user's native
  23. language.</para-->
  24. <para>Gettext 软件包包含国际化和本地化工具,
  25. 它们允许程序在编译时加入 NLS (母语支持)功能,
  26. 使它们能够以用户的母语输出消息。</para>
  27. <segmentedlist>
  28. <segtitle>&buildtime;</segtitle>
  29. <segtitle>&diskspace;</segtitle>
  30. <seglistitem>
  31. <seg>&gettext-ch6-sbu;</seg>
  32. <seg>&gettext-ch6-du;</seg>
  33. </seglistitem>
  34. </segmentedlist>
  35. </sect2>
  36. <sect2 role="installation">
  37. <title>安装 Gettext</title>
  38. <!-- This has been fixed in upstream gnulib, when a new version of
  39. gettext is released, please check #4055 to see if the change has been
  40. picked up in this package
  41. As of April 11, 2018, 'TESTS = test-lock' is in gettext-runtime/tests/Makefile.am
  42. Perhaps the test is fixed.
  43. There is no reference to 'test' or TEST in gettext-tools/gnulib-tests/Makefile.am
  44. -->
  45. <para>首先,取消 test-lock 的两次执行,因为它在某些机器上会死循环:
  46. </para>
  47. <screen><userinput remap="pre">sed -i '/^TESTS =/d' gettext-runtime/tests/Makefile.in &amp;&amp;
  48. sed -i 's/test-lock..EXEEXT.//' gettext-tools/gnulib-tests/Makefile.in</userinput></screen>
  49. <!-- As of April 11, 2018 appdata.* is NOT in git master, but appears
  50. to be in metainfo.{its,loc}, When updating, check BLFS gnome-screenshot. -->
  51. <para>现在修复一个配置文件:</para>
  52. <screen><userinput remap="pre">sed -e '/AppData/{N;N;p;s/\.appdata\./.metainfo./}' \
  53. -i gettext-tools/its/appdata.loc</userinput></screen>
  54. <para>准备编译 Gettext:</para>
  55. <screen><userinput remap="configure">./configure --prefix=/usr \
  56. --disable-static \
  57. --docdir=/usr/share/doc/gettext-&gettext-version;</userinput></screen>
  58. <para>编译该软件包:</para>
  59. <screen><userinput remap="make">make</userinput></screen>
  60. <para>输入以下命令以测试编译结果(需要较长时间, 大约 3 SBU):</para>
  61. <screen><userinput remap="test">make check</userinput></screen>
  62. <para>安装该软件包:</para>
  63. <screen><userinput remap="install">make install
  64. chmod -v 0755 /usr/lib/preloadable_libintl.so</userinput></screen>
  65. </sect2>
  66. <sect2 id="contents-gettext" role="content">
  67. <title>Gettext 的内容</title>
  68. <segmentedlist>
  69. <segtitle>安装的程序</segtitle>
  70. <segtitle>安装的库</segtitle>
  71. <segtitle>安装的目录</segtitle>
  72. <seglistitem>
  73. <seg>autopoint, envsubst, gettext, gettext.sh,
  74. gettextize, msgattrib, msgcat, msgcmp, msgcomm, msgconv, msgen,
  75. msgexec, msgfilter, msgfmt, msggrep, msginit, msgmerge, msgunfmt, msguniq,
  76. ngettext, recode-sr-latin, 以及 xgettext</seg>
  77. <seg>libasprintf.so, libgettextlib.so, libgettextpo.so,
  78. libgettextsrc.so, 以及 preloadable_libintl.so</seg>
  79. <seg>/usr/lib/gettext, /usr/share/doc/gettext-&gettext-version;, 以及
  80. /usr/share/gettext</seg>
  81. </seglistitem>
  82. </segmentedlist>
  83. <variablelist>
  84. <bridgehead renderas="sect3">简要描述</bridgehead>
  85. <?dbfo list-presentation="list"?>
  86. <?dbhtml list-presentation="table"?>
  87. <varlistentry id="autopoint">
  88. <term><command>autopoint</command></term>
  89. <listitem>
  90. <para>将标准 Gettext 微架构文件复制到源代码包</para>
  91. <indexterm zone="ch-system-gettext autopoint">
  92. <primary sortas="b-autopoint">autopoint</primary>
  93. </indexterm>
  94. </listitem>
  95. </varlistentry>
  96. <varlistentry id="envsubst">
  97. <term><command>envsubst</command></term>
  98. <listitem>
  99. <para>替换 shell 格式化字符串中的环境变量</para>
  100. <indexterm zone="ch-system-gettext envsubst">
  101. <primary sortas="b-envsubst">envsubst</primary>
  102. </indexterm>
  103. </listitem>
  104. </varlistentry>
  105. <varlistentry id="gettext">
  106. <term><command>gettext</command></term>
  107. <listitem>
  108. <para>通过查询消息目录中的翻译,将中性语言消息翻译成用户的语言
  109. </para>
  110. <indexterm zone="ch-system-gettext gettext">
  111. <primary sortas="b-gettext">gettext</primary>
  112. </indexterm>
  113. </listitem>
  114. </varlistentry>
  115. <varlistentry id="gettext.sh">
  116. <term><command>gettext.sh</command></term>
  117. <listitem>
  118. <para>主要用于 gettext 的 shell 函数库</para>
  119. <indexterm zone="ch-system-gettext gettext.sh">
  120. <primary sortas="b-gettext.sh">gettext.sh</primary>
  121. </indexterm>
  122. </listitem>
  123. </varlistentry>
  124. <varlistentry id="gettextize">
  125. <term><command>gettextize</command></term>
  126. <listitem>
  127. <para>将所有标准 Gettext 文件复制到软件包顶层目录中,
  128. 以开始国际化该软件包</para>
  129. <indexterm zone="ch-system-gettext gettextize">
  130. <primary sortas="b-gettextize">gettextize</primary>
  131. </indexterm>
  132. </listitem>
  133. </varlistentry>
  134. <varlistentry id="msgattrib">
  135. <term><command>msgattrib</command></term>
  136. <listitem>
  137. <para>根据属性过滤翻译目录中的消息,或修改这些属性</para>
  138. <indexterm zone="ch-system-gettext msgattrib">
  139. <primary sortas="b-msgattrib">msgattrib</primary>
  140. </indexterm>
  141. </listitem>
  142. </varlistentry>
  143. <varlistentry id="msgcat">
  144. <term><command>msgcat</command></term>
  145. <listitem>
  146. <para>连接并合并给定的
  147. <filename class="extension">.po</filename> 文件</para>
  148. <indexterm zone="ch-system-gettext msgcat">
  149. <primary sortas="b-msgcat">msgcat</primary>
  150. </indexterm>
  151. </listitem>
  152. </varlistentry>
  153. <varlistentry id="msgcmp">
  154. <term><command>msgcmp</command></term>
  155. <listitem>
  156. <para>比较两个 <filename class="extension">.po</filename>
  157. 文件,以检查它们是否包含相同的 msgid 字符串集合</para>
  158. <indexterm zone="ch-system-gettext msgcmp">
  159. <primary sortas="b-msgcmp">msgcmp</primary>
  160. </indexterm>
  161. </listitem>
  162. </varlistentry>
  163. <varlistentry id="msgcomm">
  164. <term><command>msgcomm</command></term>
  165. <listitem>
  166. <para>找出给定的多个
  167. <filename class="extension">.po</filename> 中的公共消息</para>
  168. <indexterm zone="ch-system-gettext msgcomm">
  169. <primary sortas="b-msgcomm">msgcomm</primary>
  170. </indexterm>
  171. </listitem>
  172. </varlistentry>
  173. <varlistentry id="msgconv">
  174. <term><command>msgconv</command></term>
  175. <listitem>
  176. <para>将翻译目录转换成另一种字符编码</para>
  177. <indexterm zone="ch-system-gettext msgconv">
  178. <primary sortas="b-msgconv">msgconv</primary>
  179. </indexterm>
  180. </listitem>
  181. </varlistentry>
  182. <varlistentry id="msgen">
  183. <term><command>msgen</command></term>
  184. <listitem>
  185. <para>创建英文翻译目录</para>
  186. <indexterm zone="ch-system-gettext msgen">
  187. <primary sortas="b-msgen">msgen</primary>
  188. </indexterm>
  189. </listitem>
  190. </varlistentry>
  191. <varlistentry id="msgexec">
  192. <term><command>msgexec</command></term>
  193. <listitem>
  194. <para>对翻译目录中的所有翻译执行命令</para>
  195. <indexterm zone="ch-system-gettext msgexec">
  196. <primary sortas="b-msgexec">msgexec</primary>
  197. </indexterm>
  198. </listitem>
  199. </varlistentry>
  200. <varlistentry id="msgfilter">
  201. <term><command>msgfilter</command></term>
  202. <listitem>
  203. <para>对翻译目录中的所有翻译应用过滤器</para>
  204. <indexterm zone="ch-system-gettext msgfilter">
  205. <primary sortas="b-msgfilter">msgfilter</primary>
  206. </indexterm>
  207. </listitem>
  208. </varlistentry>
  209. <varlistentry id="msgfmt">
  210. <term><command>msgfmt</command></term>
  211. <listitem>
  212. <para>根据翻译目录创建二进制消息目录</para>
  213. <indexterm zone="ch-system-gettext msgfmt">
  214. <primary sortas="b-msgfmt">msgfmt</primary>
  215. </indexterm>
  216. </listitem>
  217. </varlistentry>
  218. <varlistentry id="msggrep">
  219. <term><command>msggrep</command></term>
  220. <listitem>
  221. <para>找出翻译目录中所有匹配给定模式,
  222. 或属于给定源代码文件的消息</para>
  223. <indexterm zone="ch-system-gettext msggrep">
  224. <primary sortas="b-msggrep">msggrep</primary>
  225. </indexterm>
  226. </listitem>
  227. </varlistentry>
  228. <varlistentry id="msginit">
  229. <term><command>msginit</command></term>
  230. <listitem>
  231. <para>创建一个新的 <filename class="extension">.po</filename>
  232. 文件,以用户环境中的值初始化其元信息</para>
  233. <indexterm zone="ch-system-gettext msginit">
  234. <primary sortas="b-msginit">msginit</primary>
  235. </indexterm>
  236. </listitem>
  237. </varlistentry>
  238. <varlistentry id="msgmerge">
  239. <term><command>msgmerge</command></term>
  240. <listitem>
  241. <para>将两个原始翻译文件组合成一个文件</para>
  242. <indexterm zone="ch-system-gettext msgmerge">
  243. <primary sortas="b-msgmerge">msgmerge</primary>
  244. </indexterm>
  245. </listitem>
  246. </varlistentry>
  247. <varlistentry id="msgunfmt">
  248. <term><command>msgunfmt</command></term>
  249. <listitem>
  250. <para>反编译二进制消息目录,生成原始翻译文本</para>
  251. <indexterm zone="ch-system-gettext msgunfmt">
  252. <primary sortas="b-msgunfmt">msgunfmt</primary>
  253. </indexterm>
  254. </listitem>
  255. </varlistentry>
  256. <varlistentry id="msguniq">
  257. <term><command>msguniq</command></term>
  258. <listitem>
  259. <para>去除翻译目录中重复的翻译</para>
  260. <indexterm zone="ch-system-gettext msguniq">
  261. <primary sortas="b-msguniq">msguniq</primary>
  262. </indexterm>
  263. </listitem>
  264. </varlistentry>
  265. <varlistentry id="ngettext">
  266. <term><command>ngettext</command></term>
  267. <listitem>
  268. <para>显示某条语法形式依赖于数字的文本消息的母语翻译</para>
  269. <indexterm zone="ch-system-gettext ngettext">
  270. <primary sortas="b-ngettext">ngettext</primary>
  271. </indexterm>
  272. </listitem>
  273. </varlistentry>
  274. <varlistentry id="recode-sr-latin">
  275. <term><command>recode-sr-latin</command></term>
  276. <listitem>
  277. <para>将塞尔维亚语文本从西里尔字符转换为拉丁字符</para>
  278. <indexterm zone="ch-system-gettext recode-sr-latin">
  279. <primary sortas="b-recode-sr-latin">recode-sr-latin</primary>
  280. </indexterm>
  281. </listitem>
  282. </varlistentry>
  283. <varlistentry id="xgettext">
  284. <term><command>xgettext</command></term>
  285. <listitem>
  286. <para>从给定源代码文件中提取可翻译消息,以生成最初的翻译模板
  287. </para>
  288. <indexterm zone="ch-system-gettext xgettext">
  289. <primary sortas="b-xgettext">xgettext</primary>
  290. </indexterm>
  291. </listitem>
  292. </varlistentry>
  293. <varlistentry id="libasprintf">
  294. <term><filename class="libraryfile">libasprintf</filename></term>
  295. <listitem>
  296. <para>定义 <emphasis>autosprintf</emphasis> 类,使得
  297. C 格式化输出子程序在 C++ 程序中可用,能够与
  298. <emphasis>&lt;string&gt;</emphasis> 字符串和
  299. <emphasis>&lt;iostream&gt;</emphasis> 流一起使用</para>
  300. <indexterm zone="ch-system-gettext libasprintf">
  301. <primary sortas="c-libasprintf">libasprintf</primary>
  302. </indexterm>
  303. </listitem>
  304. </varlistentry>
  305. <varlistentry id="libgettextlib">
  306. <term><filename class="libraryfile">libgettextlib</filename></term>
  307. <listitem>
  308. <para>一个内部库,包含若干 Gettext 程序的公共子程序;
  309. 不建议普遍使用</para>
  310. <indexterm zone="ch-system-gettext libgettextlib">
  311. <primary sortas="c-libgettextlib">libgettextlib</primary>
  312. </indexterm>
  313. </listitem>
  314. </varlistentry>
  315. <varlistentry id="libgettextpo">
  316. <term><filename class="libraryfile">libgettextpo</filename></term>
  317. <listitem>
  318. <para>用于编写处理
  319. <filename class="extension">.po</filename> 文件的专用程序;
  320. 这个库在 Gettext 发行的标准程序 (如
  321. <command>msgcomm</command>, <command>msgcmp</command>,
  322. <command>msgattrib</command>, 以及 <command>msgen</command>)
  323. 不能满足要求时使用</para>
  324. <indexterm zone="ch-system-gettext libgettextpo">
  325. <primary sortas="c-libgettextpo">libgettextpo</primary>
  326. </indexterm>
  327. </listitem>
  328. </varlistentry>
  329. <varlistentry id="libgettextsrc">
  330. <term><filename class="libraryfile">libgettextsrc</filename></term>
  331. <listitem>
  332. <para>一个内部库,包含若干 Gettext 程序使用的公共子程序;
  333. 没有设计为普遍使用</para>
  334. <indexterm zone="ch-system-gettext libgettextsrc">
  335. <primary sortas="c-libgettextsrc">libgettextsrc</primary>
  336. </indexterm>
  337. </listitem>
  338. </varlistentry>
  339. <varlistentry id="preloadable_libintl">
  340. <term><filename class="libraryfile">preloadable_libintl</filename></term>
  341. <listitem>
  342. <para>一个被设计为由 LD_PRELOAD 预加载的库,帮助
  343. <filename class="libraryfile">libintl</filename>
  344. 记录未翻译的消息</para>
  345. <indexterm zone="ch-system-gettext preloadable_libintl">
  346. <primary sortas="c-preloadable_libintl">preloadable_libintl</primary>
  347. </indexterm>
  348. </listitem>
  349. </varlistentry>
  350. </variablelist>
  351. </sect2>
  352. </sect1>