cvs: peardoc /en/package/internationalization translation2.xml /en/package/internationalization/translation2 intro-containers.xml

From: Date: Sat, 19 Jun 2004 23:07:47 +0000
Subject: cvs: peardoc /en/package/internationalization translation2.xml /en/package/internationalization/translation2 intro-containers.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-4447@lists.php.net to get a copy of this message
quipo Sat Jun 19 19:07:47 2004 EDT Modified files: /peardoc/en/package/internationalization translation2.xml /peardoc/en/package/internationalization/translation2 intro-containers.xml Log: small fixes to the last commit (mostly whitespaces in CDATA sections)

http://cvs.php.net/diff.php/peardoc/en/package/internationalization/translation2.xml?r1=1.9&r2=1.10&ty=u Index: peardoc/en/package/internationalization/translation2.xml diff -u peardoc/en/package/internationalization/translation2.xml:1.9 peardoc/en/package/internationalization/translation2.xml:1.10 --- peardoc/en/package/internationalization/translation2.xml:1.9 Sat Jun 19 16:56:36 2004 +++ peardoc/en/package/internationalization/translation2.xml Sat Jun 19 19:07:47 2004 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.9 $ --> +<!-- $Revision: 1.10 $ --> <sect1 id="package.internationalization.translation2"> <title>Translation2</title> <refentry id="package.internationalization.translation2.translation2-summary"> @@ -259,13 +259,13 @@ <entry> <link linkend="package.internationalization.translation2.translation2-decorator-bbcode-summary">Translation2_Decorator_BBCode</link> </entry> - <entry>Renders BBCode. Requires PEAR::HTML_BBCodeParser</entry> + <entry>Renders BBCode. Requires PEAR::<classname>HTML_BBCodeParser</classname></entry> </row> <row> <entry> <link linkend="package.internationalization.translation2.translation2-decorator-cachelitefunction-summary">Translation2_Decorator_CacheLiteFunction</link> </entry> - <entry>Decorator to cache fetched data using Cache_Lite_Function class</entry> + <entry>Decorator to cache fetched data using <classname>Cache_Lite_Function</classname> class</entry> </row> <row> <entry> @@ -322,14 +322,14 @@ Class Summary <classname>Translation2_Decorator_BBCode</classname> </refname> - <refpurpose>Renders BBCode. Requires PEAR::HTML_BBCodeParser</refpurpose> + <refpurpose>Renders BBCode. Requires PEAR::<classname>HTML_BBCodeParser</classname></refpurpose> </refnamediv> <refsect1> <title>BBCode Decorator Example</title> <para> - This decorator renders BBCode stored in the translated strings. - It requires PEAR::HTML_BBCodeParser. You can choose what filters to use - via the <parameter>bbcodeFilters</parameter> option: + This decorator renders BBCode stored in the translated strings. + It requires PEAR::<classname>HTML_BBCodeParser</classname>. You can choose what + filters to use via the <parameter>bbcodeFilters</parameter> option: <programlisting role="php"> <![CDATA[ $tr = new Translation2($driver, $dbinfo, $params); @@ -511,7 +511,7 @@ <refsect1> <title>Cache_Lite_Function Decorator Example</title> <para> - This decorator provides a very efficient cache layer. + This decorator provides a very efficient cache layer. It requires PEAR::<classname>Cache_Lite</classname>. It supports all the options supported by <classname>Cache_Lite</classname>: <itemizedlist> @@ -701,7 +701,7 @@ <![CDATA[ $tr = new Translation2($driver, $dbinfo, $params); $tr =& $tr->getDecorator('CacheMemory'); -$tr->setOption('prefetch', true); //default value is &true; +$tr->setOption('prefetch', true); //default value is true ]]> </programlisting> </para> @@ -871,7 +871,7 @@ <title>DefaultText Decorator Example</title> <para> When the fetched string is empty, it replaces it with the 4th parameter - of the <function>get</function> method, i.e. $defaultText. + of the <function>get</function> method, i.e. <parameter>$defaultText</parameter>. When <function>getPage</function> is called, all the empty strings in the page are replaced by their stringID value. <programlisting role="php"> http://cvs.php.net/diff.php/peardoc/en/package/internationalization/translation2/intro-containers.xml?r1=1.1&r2=1.2&ty=u Index: peardoc/en/package/internationalization/translation2/intro-containers.xml diff -u peardoc/en/package/internationalization/translation2/intro-containers.xml:1.1 peardoc/en/package/internationalization/translation2/intro-containers.xml:1.2 --- peardoc/en/package/internationalization/translation2/intro-containers.xml:1.1 Sat Jun 19 16:56:36 2004 +++ peardoc/en/package/internationalization/translation2/intro-containers.xml Sat Jun 19 19:07:47 2004 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="package.internationalization.translation2.intro-containers"> <refnamediv> <refname>Containers Overview</refname> @@ -14,17 +14,17 @@ <refsect1 id="package.internationalization.translation2.intro-containers.db"> <title> - <classname>PEAR::DB</classname>, <classname>PEAR::MDB</classname>, + <classname>PEAR::DB</classname>, <classname>PEAR::MDB</classname>, <classname>PEAR::MDB2</classname> </title> <para> <classname>Translation2</classname> can work with any of these database abstraction - layers, just pass the appropriate connection options. + layers, just pass the appropriate connection options. These three containers are absolutely identical in what they do and in how they work (wrt <classname>Translation2</classname>, of course). <programlisting role="php"> <![CDATA[ -// connection options +// connection options $dbinfo = array( 'hostspec' => 'host', 'database' => 'dbname', @@ -40,9 +40,9 @@ ]]> </programlisting> If your table definition is different from the default one, you need to - specify it in the + specify it in the <link linkend="package.internationalization.translation2.intro.example1"> - <parameter>params</parameter> + <parameter>$params</parameter> </link> array. </para> </refsect1> @@ -55,92 +55,96 @@ to the DAO. This storage driver can use all databases supported by the PEAR::DB abstraction layer to fetch data. </para> - + <para> For this container, you can&apos;t specify a custom table definition, since this feature is not supported yet. You must create a table with the following structure: <programlisting> - // meta data etc. not supported - table: translations - id // not null primary key autoincrement.. - string_id // translation id - page // indexed varchar eg. (mytemplate.html) - lang // index varchar (eg. en|fr|.....) - translation // the translated value in language lang. +<![CDATA[ +// meta data etc. not supported +table: translations +id // not null primary key autoincrement.. +string_id // translation id +page // indexed varchar eg. (mytemplate.html) +lang // index varchar (eg. en|fr|.....) +translation // the translated value in language lang. +]]> </programlisting> - + Here&apos;s the MySQL query that can be used to create the table: <programlisting> - create table translations ( - id int(11) auto_increment not null primary key, - string_id int(11), page varchar(128), - lang varchar(10), translation text - ); - alter table translations add index page (page); - alter table translations add index lang (lang); - alter table translations add index string_id (string_id); +<![CDATA[ +create table translations ( + id int(11) auto_increment not null primary key, + string_id int(11), page varchar(128), + lang varchar(10), translation text +); +alter table translations add index page (page); +alter table translations add index lang (lang); +alter table translations add index string_id (string_id); +]]> </programlisting> then just run the dataobjects createtables script. </para> </refsect1> - + <refsect1 id="package.internationalization.translation2.intro-containers.gettext"> <title>Gettext</title> <para> - This is a wrapper around the gettext base functions, and thanks to + This is a wrapper around the gettext base functions, and thanks to <classname>File_Gettext</classname> you can retrieve an entire domain or write to an existing/new domain without calling the command line compiler utility. </para> - + <para> The connection parameters are a bit different from the db ones. - To make things as simple as possible, the domain definitions and the + To make things as simple as possible, the domain definitions and the available language list are read from two .ini files. - + langs.ini example: <programlisting> <![CDATA[ - [en] - use = en_US - - [en_US] - id = en - name = English - meta = iso-8859-1 - error_text = not available in English - windows = enu - - [en_GB] - id = en_GB - name = English - meta = iso-8859-1 - error_text = not available in English - windows = eng - - [it] - id = it - name = italiano - meta = iso-8859-1 - error_text = non disponibile in Italiano - windows = ita - - [de] - id = de - name = deutsch - meta = iso-8859-1 - error_text = not available - windows = de_DE +[en] +use = en_US + +[en_US] +id = en +name = English +meta = iso-8859-1 +error_text = not available in English +windows = enu + +[en_GB] +id = en_GB +name = English +meta = iso-8859-1 +error_text = not available in English +windows = eng + +[it] +id = it +name = italiano +meta = iso-8859-1 +error_text = non disponibile in Italiano +windows = ita + +[de] +id = de +name = deutsch +meta = iso-8859-1 +error_text = not available +windows = de_DE ]]> </programlisting> - + domains.ini example: <programlisting> <![CDATA[ - messages = /path/to/locale - 2nddomain = /path/to/locale - 3rddomain = /path/to/locale +messages = /path/to/locale +2nddomain = /path/to/locale +3rddomain = /path/to/locale ]]> </programlisting> @@ -162,7 +166,7 @@ $tr->setLang('en'); echo $tr->get('mystring'); print_r($tr->getPage('3rddomain')); -]]> +]]> </programlisting> </para>
« previous php.pear.doc (#4447) next »