cvs: php-gtk-doc /manual/zh_cn/tutorials gtk_pango_co.xml hello_world.xml helloadvanced.xml installation.xml translation.xml /stylesheets/common zh_cn.xml

[email protected] ("Anant Narayanan") Fri, 08 Dec 2006 15:19:59 -0000
Newsgroups php.gtk.doc
Message-ID <cvsanant1165591199@cvsserver>
anant		Fri Dec  8 15:19:59 2006 UTC

  Added files:                 
    /php-gtk-doc/manual/zh_cn/tutorials	gtk_pango_co.xml 
                                       	hello_world.xml 
                                       	helloadvanced.xml 
                                       	installation.xml 
                                       	translation.xml 

  Modified files:              
    /php-gtk-doc/stylesheets/common	zh_cn.xml 
  Log:
  More zh_cn translations by Mike
anant-20061208151959.txt (text/plain, 34.8 KB)
http://cvs.php.net/viewvc.cgi/php-gtk-doc/stylesheets/common/zh_cn.xml?r1=1.4&r2=1.5&diff_format=u
Index: php-gtk-doc/stylesheets/common/zh_cn.xml
diff -u php-gtk-doc/stylesheets/common/zh_cn.xml:1.4 php-gtk-doc/stylesheets/common/zh_cn.xml:1.5
--- php-gtk-doc/stylesheets/common/zh_cn.xml:1.4	Mon Dec  4 15:28:42 2006
+++ php-gtk-doc/stylesheets/common/zh_cn.xml	Fri Dec  8 15:19:59 2006
@@ -1,94 +1,95 @@
-<?xml version="1.0" encoding="utf-8"?>
-<localization language="zh_cn">
-
-   <gentext key="by" text="by"/>
-   <gentext key="callback" text="Callback function"/>
-   <gentext key="constructor" text="Constructor"/>
-   <gentext key="constructors" text="Constructors"/>
-   <gentext key="copyright" text="Copyright"/>
-   <gentext key="description" text="Description"/>
-   <gentext key="directsubclasses" text="Direct Subclasses"/>
-   <gentext key="editedby" text="Edited by:"/>
-   <gentext key="fields" text="Fields"/>
-   <gentext key="glossary" text="Glossary"/>
-   <gentext key="implementedby" text="Implemented by"/>
-   <gentext key="implementedinterfaces" text="Implemented Interfaces"/>
-   <gentext key="interfacewarning" text="This is an interface and cannot be instantiated directly."/>
-   <gentext key="listofexamples" text="List of Examples"/>
-   <gentext key="listoffigures" text="List of Figures"/>
-   <gentext key="listoftables" text="List of Tables"/>
-   <gentext key="methods" text="Methods"/>
-   <gentext key="nav-prev" text="Prev"/>
-   <gentext key="nav-next" text="Next"/>
-   <gentext key="nav-up" text="Up"/>
-   <gentext key="nav-home" text="Home"/>
-   <gentext key="nosubclasses" text="None."/>
-   <gentext key="note" text="Note"/>
-   <gentext key="objecthierarchy" text="Object Hierarchy"/>
-   <gentext key="PHPGTKauths" text="PHP-GTK Author"/>
-   <gentext key="PHPGTKcons" text="Current Contributors"/>
-   <gentext key="PHPGTKconsp" text="PHP-GTK 1 Contributors"/>
-   <gentext key="PHPGTKeditors" text="Current PHP-GTK Manual Editors"/>
-   <gentext key="PHPGTKeditorsp" text="PHP-GTK 1 Manual Editors"/>
-   <gentext key="PHPGTKmanauths" text="Current PHP-GTK Manual Authors"/>
-   <gentext key="PHPGTKmanauthsp" text="PHP-GTK 1 Manual Authors"/>
-   <gentext key="properties" text="Properties"/>
-   <gentext key="propertiesDisclaimer" text="Use get_property and set_property methods to access these."/>
-   <gentext key="seealso" text="See also"/>
-   <gentext key="signals" text="Signals"/>
-   <gentext key="styleproperties" text="Style Properties"/>
-   <gentext key="stylepropertiesDisclaimer" text="Can be set with rc files/strings only."/>
-   <gentext key="symbolicname" text="Symbolic name"/>
-   <gentext key="tableofcontents" text="Table of Contents"/>
-   <gentext key="translatedby" text="Translated by:"/>
-   <gentext key="tip" text="Tip"/>
-   <gentext key="value" text="Value"/> 
-
-   <context name="glossary">
-      <template name="seealso" text="&#21478;&#35265; "/>
-   </context>
-
-   <context name="title">
-      <template name="appendix" text="%t"/>
-      <template name="book" text="%t"/>
-      <template name="chapter" text="%t"/>
-      <template name="classset" text="%t"/>
-      <template name="classentry" text="%t"/>
-      <template name="classtree" text="%t"/>
-      <template name="constructor" text="%t"/>
-      <template name="constructors" text="%t"/>
-      <template name="enum" text="%t"/>
-      <template name="enums" text="%t"/>
-      <template name="enumset" text="%t"/>
-      <template name="example" text="%t"/>
-      <template name="field" text="%t"/>
-      <template name="fields" text=""/>
-      <template name="figure" text="%t"/>
-      <template name="glossary" text="%t"/>
-      <template name="legalnotice" text="%t"/>
-      <template name="index" text="%t"/>
-      <template name="method" text="%t"/>
-      <template name="methods" text=""/>
-      <template name="part" text="%t"/>
-      <template name="partintro" text="%t"/>
-      <template name="prop" text="%t"/>
-      <template name="property" text="%t"/>
-      <template name="properties" text=""/>
-      <template name="styleproperties" text=""/>
-      <template name="reference" text="%t"/>
-      <template name="refentry" text="%t"/>
-      <template name="set" text="%t"/>
-      <template name="setinfo" text=""/>
-      <template name="setindex" text="%t"/>
-      <template name="signal" text="%t"/>
-      <template name="signals" text=""/>
-      <template name="table" text="%t"/>
-   </context>
- 
-   <context name="section-title">
-      <template name="sect1" text="%t"/>
-      <template name="sect2" text="%t"/>
-      <template name="section" text="%t"/>
-   </context>
-
-</localization>
+<?xml version="1.0" encoding="utf-8"?>
+
+<localization language="zh_cn">
+
+   <gentext key="by" text="由"/>
+   <gentext key="callback" text="回调函数"/>
+   <gentext key="constructor" text="构造函数"/>
+   <gentext key="constructors" text="构造函数"/>
+   <gentext key="copyright" text="版权所有"/>
+   <gentext key="description" text="描述"/>
+   <gentext key="directsubclasses" text="直接子类"/>
+   <gentext key="editedby" text="编辑:"/>
+   <gentext key="fields" text="字段"/>
+   <gentext key="glossary" text="术语表"/>
+   <gentext key="implementedby" text="执行"/>
+   <gentext key="implementedinterfaces" text="执行界面"/>
+   <gentext key="interfacewarning" text="这是接口,不可以直接访问。"/>
+   <gentext key="listofexamples" text="示例列表"/>
+   <gentext key="listoffigures" text="形状列表"/>
+   <gentext key="listoftables" text="表格列表"/>
+   <gentext key="methods" text="方法"/>
+   <gentext key="nav-prev" text="向前"/>
+   <gentext key="nav-next" text="向后"/>
+   <gentext key="nav-up" text="上一层"/>
+   <gentext key="nav-home" text="首页"/>
+   <gentext key="nosubclasses" text="无"/>
+   <gentext key="note" text="注意"/>
+   <gentext key="objecthierarchy" text="对象层次"/>
+   <gentext key="PHPGTKauths" text="PHP-GTK 作者"/>
+   <gentext key="PHPGTKcons" text="内容贡献人"/>
+   <gentext key="PHPGTKconsp" text="PHP-GTK 1 贡献人"/>
+   <gentext key="PHPGTKeditors" text="当前 PHP-GTK 手册编辑"/>
+   <gentext key="PHPGTKeditorsp" text="PHP-GTK 1 手册编辑"/>
+   <gentext key="PHPGTKmanauths" text="当前 PHP-GTK 手册作者"/>
+   <gentext key="PHPGTKmanauthsp" text="PHP-GTK 1 手册作者"/>
+   <gentext key="properties" text="属性"/>
+   <gentext key="propertiesDisclaimer" text="使用 get_property 和 set_property 方法访问这个。"/>
+   <gentext key="seealso" text="另见"/>
+   <gentext key="signals" text=""/>
+   <gentext key="styleproperties" text="样式属性"/>
+   <gentext key="stylepropertiesDisclaimer" text="只可设置为资源文件或字符串。"/>
+   <gentext key="symbolicname" text="符号名称"/>
+   <gentext key="tableofcontents" text="目录"/>
+   <gentext key="translatedby" text="翻译:"/>
+   <gentext key="tip" text="提示"/>
+   <gentext key="value" text="值"/> 
+
+   <context name="glossary">
+      <template name="seealso" text="另见"/>
+   </context>
+
+   <context name="title">
+      <template name="appendix" text="%t"/>
+      <template name="book" text="%t"/>
+      <template name="chapter" text="%t"/>
+      <template name="classset" text="%t"/>
+      <template name="classentry" text="%t"/>
+      <template name="classtree" text="%t"/>
+      <template name="constructor" text="%t"/>
+      <template name="constructors" text="%t"/>
+      <template name="enum" text="%t"/>
+      <template name="enums" text="%t"/>
+      <template name="enumset" text="%t"/>
+      <template name="example" text="%t"/>
+      <template name="field" text="%t"/>
+      <template name="fields" text=""/>
+      <template name="figure" text="%t"/>
+      <template name="glossary" text="%t"/>
+      <template name="legalnotice" text="%t"/>
+      <template name="index" text="%t"/>
+      <template name="method" text="%t"/>
+      <template name="methods" text=""/>
+      <template name="part" text="%t"/>
+      <template name="partintro" text="%t"/>
+      <template name="prop" text="%t"/>
+      <template name="property" text="%t"/>
+      <template name="properties" text=""/>
+      <template name="styleproperties" text=""/>
+      <template name="reference" text="%t"/>
+      <template name="refentry" text="%t"/>
+      <template name="set" text="%t"/>
+      <template name="setinfo" text=""/>
+      <template name="setindex" text="%t"/>
+      <template name="signal" text="%t"/>
+      <template name="signals" text=""/>
+      <template name="table" text="%t"/>
+   </context>
+ 
+   <context name="section-title">
+      <template name="sect1" text="%t"/>
+      <template name="sect2" text="%t"/>
+      <template name="section" text="%t"/>
+   </context>
+
+</localization>

http://cvs.php.net/viewvc.cgi/php-gtk-doc/manual/zh_cn/tutorials/gtk_pango_co.xml?view=markup&rev=1.1
Index: php-gtk-doc/manual/zh_cn/tutorials/gtk_pango_co.xml
+++ php-gtk-doc/manual/zh_cn/tutorials/gtk_pango_co.xml
<?xml version="1.0" encoding="utf-8" ?>
<!-- $Revision: 1.1 $ -->
<chapter id="tutorials.gtkpangoco">
 <title>GTK, Pango &amp; Friends</title>

 <sect1>
  <simpara>
   当编写 PHP-GTK 程序以及浏览手册时,你会发现一些非常模糊的缩写。关于其中更加重要的一个在这里有一个概况。
  </simpara>

  <sect2>
   <title>PHP</title>
   <simpara>
    PHP - PHP: Hypertext Processor - 是使用广泛的多用途脚本语言,被设计用于 Web 开发,并可嵌入 HTML 中。
   </simpara>
  </sect2>

  <sect2>
   <title>GTK</title>
   <simpara>
    GTK - the GIMP Tool Kit - 是设计用于创建图形用户界面的库。它运行于多数类 UNIX 平台,Windows,以及支持 framebuffer 的设备。
   </simpara>
   <simpara>
    GTK 库本身包含元件,也就是 GUI 组件,如 <classname>GtkButton</classname> 或者 <classname>GtkTextView</classname>。
   </simpara>
   <simpara>
    GTK 依赖若干其他库的支持,如 GDK,Pango,ATK 和 GLib。并全部整合打包于 GTK+ 中。
   </simpara>
  </sect2>

  <sect2>
   <title>GDK</title>
   <simpara>
    GDK - the GIMP Drawing Kit - 是允许 GTK+ 支持多窗口系统的抽象层。GDK 可在 X11,Windows,和 Linux framebuffer 设备上提供绘制和窗口系统工具。
   </simpara>
  </sect2>

  <sect2>
   <title>Pango</title>
   <simpara>
    Pango 是国际化文本处理库。它围绕使用段落表达文本的 <classname>PangoLayout</classname> 对象。Pango 为
<classname>GtkTextView</classname>,<classname>GtkLabel</classname>,<classname>GtkEntry</classname>,以及其他 需要显示文本的 GTK+ 元件提供文本处理引擎。
   </simpara>
  </sect2>

  <sect2>
   <title>ATK</title>
   <simpara>
    ATK 是 Accessibility Tool Kit。它提供一系列的接口使得同图形用户界面交互在易用性上得到支持。例如,屏幕阅读器可以使用 ATK 获取屏幕上的文字并给盲人用户阅读。
   </simpara>
   <simpara>
    感谢 ATK 框架,GTK+ 元件可以获得内建的易用性支持。
   </simpara>
  </sect2>

 </sect1>
</chapter>

http://cvs.php.net/viewvc.cgi/php-gtk-doc/manual/zh_cn/tutorials/hello_world.xml?view=markup&rev=1.1
Index: php-gtk-doc/manual/zh_cn/tutorials/hello_world.xml
+++ php-gtk-doc/manual/zh_cn/tutorials/hello_world.xml
<?xml version="1.0" encoding="utf-8" ?>
<!-- $Revision: 1.1 $ -->
<chapter id="tutorials.helloworld">
 <title>Hello World(基础)</title>

  <simpara>
   当你开始学习一门编程语言,通常你的第一个程序都是编写“hello world”。所以,为了符合这个通常的习惯,本手册中的第一个指南也就从“hello world”指南开始!
  </simpara>
  <simpara>
   我们希望在通篇指南中紧扣 PHP 本身。指南被设计为提供用户如何使用 PHP-GTK,以及这其中的思想和技术。
  </simpara>
  <simpara>
   在这个指南中我们将创建一个简单的窗口,并有“Hello World!”的文本在上面。
  </simpara>
  <simpara>
   我们将从列出的程序开始,然后将逐行解释,提供一个非常基本的 PHP-GTK 应用的概况。
  </simpara>


  <example>
   <title>简单的 Hello World 脚本</title>
   <programlisting role="php">
    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 
     href="&directory.examples;/tutorials/helloworld/helloworld.phpw" parse="text">
     <xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback>
    </xi:include>
   </programlisting>
  </example>

  <para>
  复制代码到文本编辑器中并保存为 <filename>hello.phpw</filename>。然后开启一个控制台使用命令 <command>php hello.phpw</command>。一个标题为“Hello world”的窗口应当显示出来,除了文本“Just wanted to say 'Hello world!'”上面没有任何内容。
  </para>


  <example>
   <title>检查 PHP-GTK 是否可用</title>
   <programlisting role="php"><![CDATA[if (!class_exists('gtk')) {
    die("Please load the php-gtk2 module in your php.ini\r\n");
}]]></programlisting>
  </example>

  <para>
   这里通过检查类 <literal>gtk</literal> 是否存在来确定 PHP-GTK 是否可用。不像 PHP 4 和 PHP-GTK 1,你不应当尝试使用 <ulink url="http://www.php.net/dl">dl()</ulink> 加载 PHP-GTK 模块。在 PHP 5 中不赞成这么做,并且不应当在新的代码中使用。所以我们能做的就是输出一个消息,告诉用户模块不可用并且需要进一步设置可用。
  </para>


  <example>
   <title>创建窗口</title>
   <programlisting role="php"><![CDATA[$wnd = new GtkWindow();]]></programlisting>
  </example>

  <para>
   创建新 <link linkend="gtk.gtkwindow">窗口</link> 元件对象就像创建新对象一样简单:变量 <literal>$wnd</literal> 被赋值新的对象。如果你已经使用 PHP 4 和 PHP-GTK 1 编写过程序,你会发现你漏写了 <literal>&amp;</literal> 在 <literal>new</literal> 之前。这个在 PHP 4 中是必须的,但是在 PHP 5 中由于引用创建,所以不再需要了。
  </para>


  <example>
   <title>设置窗口标题</title>
   <programlisting role="php"><![CDATA[$wnd->set_title('Hello world');]]></programlisting>
  </example>

  <simpara>
   为了让窗口在任务栏中便于识别,我们设置窗口标题:仅仅是调用了对象的方法。
  </simpara>


  <example>
   <title>设置退出清理</title>
   <programlisting role="php"><![CDATA[$wnd->connect_simple('destroy', array('gtk', 'main_quit'));]]></programlisting>
  </example>

  <para>
   这是代码中第一处有趣的部分:<signalname class="GtkObject">destroy</signalname> 信号连接到静态方法 <link linkend="gtk.method.main_quit">Gtk::main_quit</link>。它简单的告诉 GTK 当窗口关闭或销毁时退出主循环。(关于主循环将在下面的部分解释)
  </para>


  <example>
   <title>创建一个用于显示文本的标签</title>
   <programlisting role="php"><![CDATA[$lblHello = new GtkLabel("Just wanted to say\r\n'Hello world!'");]]></programlisting>
  </example>

  <para>
   像之前一样,我们创建了一个新的元件。这次我们希望显示一小段文字,而 <classname>GtkLabel</classname> 非常适合这个任务。
  </para>


  <example>
  <title>在窗口上添加标签</title>
   <programlisting role="php"><![CDATA[$wnd->add($lblHello);]]></programlisting>
  </example>

  <simpara>
  现在我们告诉窗口,标签将会添加在上面。
  </simpara>


  <example>
   <title>显示窗口</title>
   <programlisting role="php"><![CDATA[$wnd->show_all();]]></programlisting>
  </example>

  <para>
  到现在为止,你的屏幕上还什么都没有。为了显示窗口,你需要调用 <function class="GtkWidget">show</function>。这可以显示窗口,但不包含标签——我们不得不对标签也调用 <function class="GtkWidget">show</function>。如果你在窗口上有多个元件如按钮、选择框或者其他这是很不方便的:<function class="GtkWidget">show_all</function> 会帮助显示窗口以及所有的子元件。
  </para>


  <example>
   <title>开始主循环</title>
   <programlisting role="php"><![CDATA[Gtk::main();]]></programlisting>
  </example>

  <para>
   在所有都设置好了以后,我们需要确保窗口保持开启并相应用户交互。一个普通的 PHP 脚本会中指并退出,但是我们希望它继续执行:为了这个目的,GTK 主循环被调用。用于程序保持运行并等待用户事件。如果事件发生,它将其委派到相应的回调函数中去。
  </para>


 <sect1 id="tutorials.helloworld.futherreading">
  <title>进一步阅读</title>
  <para>
   现在你已经创建了你的第一个 PHP-GTK 2 应用,你可能希望创建更加复杂的布局。阅读 <link linkend="tutorials.packing">包装指南</link> 了解基础的方法。
  </para>
 </sect1>

</chapter>
http://cvs.php.net/viewvc.cgi/php-gtk-doc/manual/zh_cn/tutorials/helloadvanced.xml?view=markup&rev=1.1
Index: php-gtk-doc/manual/zh_cn/tutorials/helloadvanced.xml
+++ php-gtk-doc/manual/zh_cn/tutorials/helloadvanced.xml
<chapter id="tutorials.helloadvanced">
<!-- $Revision: 1.1 $ -->
 <title>Hello World(高级)</title>

 <simpara>
  这个指南比第一个 hello world 指南介绍了更加高级的功能。这里,我们创建一个用户可以输入用户名和密码的登录窗口。用户点击登录按钮时,检查文本框内容,当用户忘记他的用户名或密码时显示错误的消息。
 </simpara>

 <para>
  这里有一个截屏,显示了程序完成以后的样子:
  <graphic fileref="&directory.images;/tutorials/helloadvanced.png"/>
 </para>

 <para>
  首先,创建一个窗口,设置它的标题并且设置当窗口销毁时退出主循环——这些你应当已经在之前的指南中有所了解:
  <informalexample>
   <programlisting role="php"><![CDATA[
$wnd = new GtkWindow();
$wnd->set_title('Login');
$wnd->connect_simple('destroy', array('gtk', 'main_quit'));
]]></programlisting>
  </informalexample>
 </para>

 <para>
 下一个任务是创建对话框上需要的所有元件。首先,输入用户名和密码的两个文本框:
  <informalexample>
   <programlisting role="php"><![CDATA[
$txtUsername = new GtkEntry();
$txtPassword = new GtkEntry();
]]></programlisting>
  </informalexample>
  我们希望用户明白哪个文本框输入用户名,哪个文本框输入密码,所以还需要标签用于描述:
  <informalexample>
   <programlisting role="php"><![CDATA[
//The second parameter says that the underscore should be parsed as underline
$lblUsername = new GtkLabel('_Username', true);
$lblPassword = new GtkLabel('_Password', true);
]]></programlisting>
  </informalexample>
  最后,我们需要两个按钮:一个用来登录,另一个用来取消进程:
  <informalexample>
   <programlisting role="php"><![CDATA[
$btnLogin    = new GtkButton('_Login');
$btnCancel   = new GtkButton('_Cancel');
]]></programlisting>
  </informalexample>
  你可能注意到 <classname>GtkLabel</classname> 传递的第二个参数,这表明下划线的作用是其后的字符显示下划线,而 <classname>GtkButton</classname> 的构造函数并没有这个参数:按钮的构造函数自动完成助记符的转换,而标签的并不是这样。这个行为可能对你来说有点奇怪,但是这非常类似你有一个助记符在按钮的标签上除此之外普通标签也有一个。(有问题的翻译:This behavior might be strange to you, but it's more likely that you have a mnemonic in a button's label than that a normal label has one.)
 </para>

 <para>
  现在标签需要知道当助记符激活时哪个元件被激活。由下面的方法实现:
  <informalexample>
   <programlisting role="php"><![CDATA[
$lblUsername->set_mnemonic_widget($txtUsername);
$lblPassword->set_mnemonic_widget($txtPassword);
]]></programlisting>
  </informalexample>
  更进一步,我们需要判断当按钮按下时调用哪个操作。取消按钮将会销毁窗口(这将中止应用程序)而登录按钮将检查文本框并调用进一步的操作:
  <informalexample>
   <programlisting role="php"><![CDATA[
$btnCancel->connect_simple('clicked', array($wnd, 'destroy'));
$btnLogin ->connect_simple('clicked', 'login', $wnd, $txtUsername, $txtPassword);
]]></programlisting>
  </informalexample>
  我们向(还未经定义的)<literal>login</literal> 函数传递了作为可选参数的三个元件 <varname>$wnd</varname>,
  <varname>$txtUsername</varname> 和 <varname>$txtPassword</varname> ,因为我们需要:获取文本框的值,同时如果一切正常则销毁或隐藏窗口。
 </para>

 <para>
 现在我们已经有了全部需要的元件,并添加到了窗口上。由于 <classname>GtkWindow</classname> 是二进制容器,它仅仅可容纳一个元件。所以我们需要一个可以容纳许多元件并可很好的对元件进行布局的容器。 <classname>GtkTable</classname> 是一个不错的选择,因为它可以保持标签在一列,同时文本框在下一列:
  <informalexample>
   <programlisting role="php"><![CDATA[
$tbl = new GtkTable(3, 2);
$tbl->attach($lblCredit, 0, 2, 0, 1);
$tbl->attach($lblUsername, 0, 1, 1, 2);
$tbl->attach($txtUsername, 1, 2, 1, 2);
$tbl->attach($lblPassword, 0, 1, 2, 3);
$tbl->attach($txtPassword, 1, 2, 2, 3);
]]></programlisting>
  </informalexample>
  (<varname>$lblCredit</varname> 是仅仅有一条信息的标签。).
  按钮有它们自己的 <classname>GtkHButtonBox</classname>,因为这个类可以将许多按钮排列得非常好:
  <informalexample>
   <programlisting role="php"><![CDATA[
$bbox = new GtkHButtonBox();
$bbox->set_layout(Gtk::BUTTONBOX_EDGE);
$bbox->add($btnCancel);
$bbox->add($btnLogin);
]]></programlisting>
  </informalexample>
 </para>

 <para>
  布局的最后工作是在窗口上添加 table 和 button box。这是无法直接完成的,因为 <classname>GtkWindow</classname> 继承于 <classname>GtkBin</classname> 而只能保持一个元件。所以我们需要另外的容器,这回使用 <classname>GtkVBox</classname>:
  <informalexample>
   <programlisting role="php"><![CDATA[
$vbox = new GtkVBox();
$vbox->pack_start($tbl);
$vbox->pack_start($bbox);
]]></programlisting>
  </informalexample>
   全部就这么多,我们可以显示窗口了:
  <informalexample>
   <programlisting role="php"><![CDATA[
$wnd->add($vbox);
$wnd->show_all();
Gtk::main();
]]></programlisting>
  </informalexample>
 </para>

 <para>
  最后还未完成的是 <literal>login</literal> 函数,当用户点击登录按钮时调用。它将检查用户名和密码的值:如果它们的长度是 0(用户没有输入任何内容),一个错误信息将会显示。如果一切正常,窗口将销毁同时程序继续执行并显示主窗口。
 </para>

 <para>
  从元件获取文本是非常简单的,我们仅仅需要使用 <classname>GtkEntry</classname> 的 <function class="GtkEntry">get_text</function> 方法:
  <informalexample>
   <programlisting role="php"><![CDATA[
$strUsername = $txtUsername->get_text();
$strPassword = $txtPassword->get_text();
]]></programlisting>
  </informalexample>
  使用普通的 php 函数 <literal>strlen</literal> 完成检查。如果出现错误,我们希望显示一个有一条消息的对话框。<classname>GtkMessageDialog</classname> 用于这个任务,它自动创建了图标和按钮(OK, Yes/No):
  <informalexample>
   <programlisting role="php"><![CDATA[
$dialog = new GtkMessageDialog($wnd, Gtk::DIALOG_MODAL, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, $errors);
$dialog->set_markup("The following errors occured:\r\n<span foreground='red'>" . $errors . "</span>");
$dialog->run();
$dialog->destroy();
]]></programlisting>
  </informalexample>
 </para>

 <para>
  现在你只要确保已经将 login 函数放在了主循环的前面(!),那么运行它。
 </para>

 <example>
  <title>全部代码</title>
  <programlisting role="php">
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
               href="&directory.examples;/tutorials/helloadvanced/helloadvanced.phpw"
               parse="text">
    <xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback>
   </xi:include>
  </programlisting>
 </example>

</chapter>
http://cvs.php.net/viewvc.cgi/php-gtk-doc/manual/zh_cn/tutorials/installation.xml?view=markup&rev=1.1
Index: php-gtk-doc/manual/zh_cn/tutorials/installation.xml
+++ php-gtk-doc/manual/zh_cn/tutorials/installation.xml
<?xml version="1.0" encoding="utf-8" ?>
<!-- $Revision: 1.1 $ -->
<chapter id="tutorials.installation">
 <title>安装 PHP-GTK 2</title>

  <sect1 id="tutorials.installation.introduction">
   <title>简介</title>
   <para>
    PHP-GTK 2 是 PHP 的扩展之一,并且只可用于 5.1 以及更高版本。虽然编译是最常用的安装 PHP-GTK 2 的方法,但是这一过程在 Windows 系统上也显得过于漫长。鉴于这样的原因,多数人将会选择使用官方发布的二进制 PHP-GTK 2 Alpha 版本或使用 Gnope 安装包。
   </para>
   <para>
   我们将介绍三种主流系统上面的安装过程:Windows,Linux 和 Mac OS X。关于 Linux 的介绍同样也适用于符合 POSIX 标准的系统。
   </para>
  </sect1>

  <sect1 id="tutorials.installation.windows">
  <title>在 Windows 上安装</title>

   <sect2 id="tutorials.installation.windows.gnope">
    <title>使用 Gnope</title>
    <para>
     使用 Gnope 在 Windows 上安装和维护 PHP-GTK 2 已经被证明几乎是最简单的方法。Gnope 是全功能的 PHP-GTK 2 安装包,包含 PHP 5.1、GTK 2.6 和 PEAR。简单的点几下鼠标你就可以安装完成!
    </para>
    <para>
     只要从 <ulink url="&url.gnope;">gnope.org</ulink> 下载安装包,并跟随屏幕上的指引。Gnope 也拥有它自己的 PEAR 自动安装频道,那里你可以下载 PHP-GTK 2 程序添加到官方的 PEAR 包中。例如从 <ulink url="&url.pear.gtk2;">Gtk2 category</ulink>。
    </para>
   </sect2>

   <sect2 id="tutorials.installation.windows.manual">
    <title>手工安装</title>
    <para>
     从 PHP-GTK 2 <ulink url="&url.phpgtk.download;">下载</ulink>页面下载 PHP-GTK 2 的针对 Windows 的 Alpha 版本二进制发行包。解压缩文件到指定目录。一个名为 <literal>php-gtk</literal> 的目录将会创建,并包含发行版的所有内容。
    </para>
    <para>
     你需要 <filename>php.exe</filename>(CLI 版本)和 <filename>php5ts.dll</filename>,这两个都可从 PHP 5 的 Windows 发行版中获得,并且放置到 <filename>php-gtk</filename> 目录。如果你希望使用这个 <filename>php.exe</filename> 的其他扩展,请确保你已经存放二进制文件于此。
    </para>
    <para>
     <!-- FIXME: Do we need to do this? I doubt that this is necessary
        -cweiske -->
     之后,你必须设置环境变量 <literal>PATH</literal> 包含发行包中的 <filename>gtk+2.6.9</filename> 目录。你也可以让批处理文件 <literal>gtkpath.bat</literal> 在运行时设置适当的 <literal>PATH</literal> 变量用于当前命令行会话中。
    </para>
   </sect2>

   <sect2 id="tutorials.installation.windows.cvs">
    <title>从 CVS 编译</title>
    <para>
    这里仅仅包含在 Windows 上安装 PHP-GTK 2 最主要的步骤。如果你希望了解更多内容,请从 CVS 上获取 <filename>win32/README.win32.txt</filename> 并阅读。
    </para>
   </sect2>
  </sect1>

  <sect1 id="tutorials.installation.linux">
  <title>在 Linux 上安装</title>

   <para>
   在 Linux 上安装 PHP-GTK 2 的最好方式就是编译它。还没有二进制包或源码包发行于任何 Linux 发布版本,所以你不能使用你最喜欢的包管理方式安装 PHP-GTK 2。这个介绍应当适用于多数 Linux 发行版,同时也适用于符合 POSIX 标准的系统。
   </para>

   <note>有消息表明下面的方法不能用于 FreeBSD。</note>

   <para>
    有两种方式在你的 Linux 系统上安装 PHP-GTK 2。你可以选择使用已有的 PHP 安装,或安装一套独立的用于 PHP-GTK 2 的 PHP。后一种会略微简单一些,对于缺乏或没有 Linux 经验的用户这是推荐的方法。无论如何,你都需要安装有 Gtk+ 2.6 或更新版本。
   </para>

   <sect2 id="tutorials.installation.linux.newphp">
   <title>新的 PHP 安装包上安装 PHP-GTK 2</title>

    <para>
     请遵循下面的步骤,将会一切顺利!首先你需要的是从 CVS 中新取出的 PHP。你可以选择 <literal>5_1</literal> 或 <literal>5_2</literal> 分支,都会工作得很好:

     <programlisting role="bash"><![CDATA[
$ cvs -d :pserver:[email protected]:/repository login
$ cvs -d :pserver:[email protected]:/repository co -r PHP_5_2 php-src]]></programlisting>

     现在,你需要编译并安装它:

     <programlisting role="bash"><![CDATA[
$ cd php-src
$ ./buildconf
$ ./configure --prefix=/opt/php5_2 --disable-cgi
$ make
$ su
$ make install
$ echo extension=php_gtk2.so >> /opt/php5_2/lib/php.ini
$ /opt/php5_2/bin/php-config --extension-dir | xargs echo 'extension_dir=' >> /opt/php5_2/lib/php.ini]]></programlisting>
    </para>

    <note>
     <para>
     如果当前 CVS 上的 PHP 不可以被编译,尝试从 <ulink url="&url.php.download;">php 下载页面</ulink>或 <ulink url="&url.php.snapshots;">snapshot</ulink> 下载官方发布的版本。
     </para>
    </note>

    <para>
     现在,让我们取出并安装 PHP-GTK 2:
      <programlisting role="bash"><![CDATA[
$ cd ..
$ cvs -d :pserver:[email protected]:/repository co php-gtk
$ cd php-gtk
$ ./buildconf --with-phpize=/opt/php5_2/bin/phpize
$ ./configure --with-php-config=/opt/php5_2/bin/php-config
$ make
$ make install]]></programlisting>
    </para>

    <para>
     你可能希望创建一个连接到新安装的 PHP 执行文件:
      <programlisting role="bash"><![CDATA[
$ ln -s /opt/php5_2/bin/php /usr/bin/php-gtk]]></programlisting>

     就是这些,完成了!
    </para>
   </sect2>

   <sect2 id="tutorials.installation.linux.existingphp">
    <title>使用现有的 PHP 安装包</title>

    <para>
    如果你决定“增加” PHP-GTK 2 到已有的 PHP 安装包上,请确保 PHP 的版本至少是 CLI 可用的 5.1 版。PHP-GTK 2 不能工作于其他版本的 PHP。你可以在命令行中输入 <command>php -v</command> 检查你的 PHP 版本。不要忘记检查单词 <literal>cli</literal> 是否出现在输出中。
    </para>

    <para>
     现在,从 CVS 中取出最新版本的 PHP-GTK 2 源代码,或下载 Alpha 版本的源码包,每次提到的 PHP-GTK 2 <ulink url="&url.phpgtk.download;">下载</ulink>页面。使用 <literal>cd</literal> 进入取出或解压缩的目录,并执行下面的命令:
     <programlisting role="bash"><![CDATA[
$ ./buildconf
$ ./configure
$ make
$ make install]]></programlisting>
    </para>

    <para>
     对于多数人来说这应当是可用的。然而,如果有多个 PHP 的安装在你的机器上或者你已经在其他目录安装了 PHP,你可能遇到麻烦。多数这种情况可以使用指定 <literal>phpize</literal> 和 <literal>php-config</literal> 文件的安装目录解决:
     <programlisting role="bash"><![CDATA[
$ ./buildconf --with-phpize=/path/to/phpize
$ ./configure --with-php-config=/path/to/php-config]]></programlisting>
    </para>
   </sect2>

   <sect2 id="tutorials.installation.linux.testing">
    <title>测试你的安装</title>

    <para>
     在你可以使用 PHP-GTK 2 之前,你需要在 php.ini 中设置该扩展可用。在其他 <literal>extension=</literal> 设置之下仅仅需要添加:
     <programlisting role="ini"><![CDATA[
extension=php_gtk2.so]]></programlisting>
     即可。
    </para>

    <para>
     为了确定安装是否成功,可以执行下面的内容测试:
     <programlisting role="bash"><![CDATA[
$ php -m | grep php-gtk]]></programlisting>

     你应当得到一行内容,只有 <literal>php-gtk</literal>。
    </para>

    <para>
     接下来,你可以测试在 php-gtk 源码中 <filename>demos</filename> 下的示例程序。例如 <filename>demos/phpgtk2-demo.php</filename>。
    </para>
   </sect2>
  </sect1>

  <sect1 id="tutorials.installation.macosx">
  <title>在 Mac OS X 上安装</title>

    <para>
     在安装 PHP-GTK 2 之前,应当确认你已经安装有 Apple 开发者工具(Apple Developer Tools),BSD 子系统(BSD Subsystem),和 X。虽然,BSD 子系统默认安装于 Mac OS X,但是你需要手工选择开发者工具和 X 服务器。虽然你可以使用任何 X 服务器,但是最简单的方法是使用在安装程序中 Apple 默认提供的。
    </para>

    <para>
     获取 <ulink url="&url.macports;">MacPorts</ulink> (之间被称作 DarwinPorts)或者 <ulink url="&url.fink;">Fink</ulink> 并安装。你可以选择安装某一个版本的 X (如果你决定不使用 Apple 默认发行的),以及 Gtk+ 本身。同时确保你有 5.2 版本以上的 PHP,MacPorts 提供了包。在终端中输入 <literal>php -v</literal> 获得版本信息。如果希望手工编译 PHP 你可以按如下操作:

     <programlisting role="bash"><![CDATA[
$ cvs -d :pserver:[email protected]:/repository co -r PHP_5_2 php-src
$ cd php-src
$ ./buildconf
$ ./configure --disable-cgi
$ make
$ sudo make install]]></programlisting>
    虽然你可以将它安装到任何地方,但是 <literal>/usr/local</literal> 通常都是不错的选择。MacPorts 将 PHP 安装到 <literal>/opt/local</literal>。
    </para>

    <para>
     现在获取最新版本的 PHP-GTK 并编译它:

     <programlisting role="bash"><![CDATA[
$ cd..
$ cvs -d :pserver:[email protected]:/repository co php-gtk
$ cd php-gtk
$ ./buildconf --with-phpize=/usr/local/bin/phpize
$ ./configure --with-php-config=/usr/local/bin/php-config \
            --disable-libglade
$ make
$ sudo make install]]></programlisting>
    记得替换 <literal>/usr/local</literal> 为 PHP 真实的安装路径。例如,如果你使用 MacPorts 安装 PHP 5.2,你应当输入 <literal>/opt/local</literal> 来代替。
    </para>

    <para>
     最后,复制 <literal>php.ini-recommended</literal> 文件到 <literal>/usr/local/lib/php.ini</literal> 并修改 <literal>extension_dir</literal> 的值为 <literal>php_gtk2.so</literal> 的存放位置。通常如下所示:<literal>/usr/local/lib/php/extensions/no-debug-non-zts-some-date</literal>。你可能希望在 <literal>/usr/bin</literal> 中创建新的符号连接指向 <literal>/usr/local/bin/php</literal>。再次说明,鉴于你的 PHP 安装目录,可能需要使用 <literal>/opt/local</literal> 替换 <literal>/usr/local</literal>。
    </para>

    <para>
     下面继续
     <link linkend="tutorials.installation.linux.testing">测试你的安装</link>.
    </para>
   </sect1>

</chapter>

http://cvs.php.net/viewvc.cgi/php-gtk-doc/manual/zh_cn/tutorials/translation.xml?view=markup&rev=1.1
Index: php-gtk-doc/manual/zh_cn/tutorials/translation.xml
+++ php-gtk-doc/manual/zh_cn/tutorials/translation.xml
<?xml version="1.0" encoding="utf-8" ?>
<!-- $Revision: 1.1 $ -->
<chapter id="tutorials.translation">
 <title>i18n: 使用 gettext</title>

 <sect1>
  <title>关于该指南</title>
  <simpara>
   <!-- TODO -->
  </simpara>
 </sect1>
</chapter>