cvs: presentations /slides/i18nl10n gettext_ex.php gettext_ex.xml gettext_intro.xml http.xml locales.php localization.xml multibyte.xml numfmt.php
nums.xml simple.xml simple_default.xml simple_defs_de.php simple_defs_en.php simple_defs_ex.php simple_ex.xml thanks.xml titlepage.xml tree1.png
tree2.png tree3.png tree4.png tree5.png visitation1.xml visitation2.xml visitation3.xml visitation4.xml visitation5.xml yahoo.png

From: Date: Sun, 03 Nov 2002 08:52:16 +0000
Subject: cvs: presentations /slides/i18nl10n gettext_ex.php gettext_ex.xml gettext_intro.xml http.xml locales.php localization.xml multibyte.xml numfmt.php
nums.xml simple.xml simple_default.xml simple_defs_de.php simple_defs_en.php simple_defs_ex.php simple_ex.xml thanks.xml titlepage.xml tree1.png
tree2.png tree3.png tree4.png tree5.png visitation1.xml visitation2.xml visitation3.xml visitation4.xml visitation5.xml yahoo.png
Groups: php.pres 
Request: Send a blank email to pres+get-486@lists.php.net to get a copy of this message
sterling Sun Nov 3 03:52:16 2002 EDT Added files: /presentations/slides/i18nl10n gettext_ex.php gettext_ex.xml gettext_intro.xml http.xml locales.php localization.xml multibyte.xml numfmt.php nums.xml simple.xml simple_default.xml simple_defs_de.php simple_defs_en.php simple_defs_ex.php simple_ex.xml thanks.xml titlepage.xml tree1.png tree2.png tree3.png tree4.png tree5.png visitation1.xml visitation2.xml visitation3.xml visitation4.xml visitation5.xml yahoo.png Log: plane stuff...

Index: presentations/slides/i18nl10n/gettext_ex.php +++ presentations/slides/i18nl10n/gettext_ex.php <?php bindtextdomain('messages', './'); switch ($argv[1]) { case 'de': putenv("LC_ALL=de"); break; case 'en': default: putenv("LC_ALL=en"); break; } print _("Hey"); print "\n<br>\n"; print _("This is example number ") . "2!"; ?> Index: presentations/slides/i18nl10n/gettext_ex.xml +++ presentations/slides/i18nl10n/gettext_ex.xml <slide title="Gettext Example"> <blurb> Write your PHP code. </blurb> <example filename="gettext_ex.php" fontsize="1.2em" type="php"/> <blurb> Extract the strings from the file, using the %xgettext(1)% program. </blurb> <example fontsize="1.2em" type="shell"> ]$ xgettext -a gettext_ex.php </example> <blurb> Create the appropriate subdirectories, and place your portable object files there. </blurb> <example fontsize="1.2em" type="shell"> ]$ mkdir -p en/LC_MESSAGES/ ]$ mv messages.po en/LC_MESSAGES/ ]$ mkdir -p de/LC_MESSAGES/ ]$ cp en/LC_MESSAGES/messages.po de/LC_MESSAGES/messages.po </example> <blurb> Translate it! </blurb> <blurb> Now compile all of your translations with %msgfmt(1)% </blurb> <example fontsize="1.2em" type="shell"> ]$ msgfmt messages.po -o messages.mo </example> </slide> Index: presentations/slides/i18nl10n/gettext_intro.xml +++ presentations/slides/i18nl10n/gettext_intro.xml <slide title="Gettext"> <blurb> Gettext is a LGPL library that attempts to solve the problem of internationalization in a manner that allows translators and developers to work together. </blurb> <list title="Pros"> <bullet effect="hide">Simple for both developers and programmers</bullet> <bullet effect="hide">Excellent in architecture size for small to medium translations</bullet> <bullet effect="hide">Very well integrated into the Unix system</bullet> <bullet effect="hide">Cross-platform</bullet> <bullet effect="hide">"Free" License</bullet> </list> <list title="Cons"> <bullet effect="hide">Still not good for large translations</bullet> <bullet effect="hide">Requires a bit of legwork, such as compiling translations</bullet> <bullet effect="hide">L*GPL*</bullet> </list> </slide> Index: presentations/slides/i18nl10n/http.xml +++ presentations/slides/i18nl10n/http.xml <slide title="HTTP Features"> <blurb title="Accept-Languages"> The %Accept-Languages% header is sent by the browser, and informs the website what languages (and the order in which) the user wishes to recieve information. <example title="Sample Accept-Languages Header" fontsize="1.2em" type="http"> Accept-Languages: en, de </example> </blurb> </slide> Index: presentations/slides/i18nl10n/locales.php +++ presentations/slides/i18nl10n/locales.php <?php $c = localeconv(); var_dump($c); ?> Index: presentations/slides/i18nl10n/localization.xml +++ presentations/slides/i18nl10n/localization.xml <slide title="l10n basics"> <list title="Types of l10n"> <bullet effect="slide">Number and Currency</bullet> <bullet effect="slide">Content</bullet> </list> </slide> Index: presentations/slides/i18nl10n/multibyte.xml +++ presentations/slides/i18nl10n/multibyte.xml <slide title="Multibyte Strings"> <blurb> To deal with multibyte characters and encodings (such as Japanese and Korean) you may use the %mbstring% extension. </blurb> <list title="What does Mbstring provide?"> <bullet effect="hide">Support for ASCII, JIS, Shift-JIS, EUC-(JP|CN|TW|KR), UTF8, Big5, CP866, CP936, CP1251, Koi8r encodings</bullet> <bullet effect="hide">Replacement for many of PHP's standard string handling functions.</bullet> <bullet effect="hide">Multibyte regular expressions</bullet> <bullet effect="hide">Transparent encoding handlers via PHP's output handling mechanism</bullet> </list> </slide> Index: presentations/slides/i18nl10n/numfmt.php +++ presentations/slides/i18nl10n/numfmt.php <?php $linfo = localeconv(); function locale_num ($n) { global $linfo; return number_format($n, $linfo['decimal_point'], $linfo['thousands_sep']); } print locale_num(100); print locale_num(200203002); print locale_num(139939.23321); ?> Index: presentations/slides/i18nl10n/nums.xml +++ presentations/slides/i18nl10n/nums.xml <slide title="Numbers and Currencies"> <blurb> Every country has a different way of displaying numbers and currencies, even if you will be displaying the same number. </blurb> <blurb title="localeconv()"> The %localconv()% function will give you all necessary information about the current locale. </blurb> <example filename="locales.php" fontsize="1.2em" type="php"/> <blurb title="number_format()"> The %number_format()% function along with %localeconv()% will allow you to get locale specific information. </blurb> <example filename="numfmt.php" fontsize="1.2em" type="php"/> </slide> Index: presentations/slides/i18nl10n/simple.xml +++ presentations/slides/i18nl10n/simple.xml <slide title="Simple i18n"> <blurb> Use a set of defines that represent the textual portions of your website. </blurb> <list title="Pros"> <bullet effect="hide">Extremely Simple</bullet> <bullet effect="hide">Requires very little overhead</bullet> <bullet effect="hide">Good For Sites with Little Predefined Text</bullet> </list> <list title="Cons"> <bullet effect="hide">Having non technical translators is hard</bullet> <bullet effect="hide">Large Portions of text are nearly impossible</bullet> <bullet effect="hide">Full translations are required</bullet> </list> </slide> Index: presentations/slides/i18nl10n/simple_default.xml +++ presentations/slides/i18nl10n/simple_default.xml <slide title="Default Translations"> <blurb> What happens when a translation is out of date? </blurb> <list title="Solutions"> <bullet effect="slide">Create a custom %define()% function, that checks for constant definitions, and uses the default definitions if available</bullet> <bullet effect="slide">Pregenerate your language definition files, substituting untranslated definitions with their replacements</bullet> <bullet effect="slide">Use a more advanced solution, ala gettext</bullet> </list> </slide> Index: presentations/slides/i18nl10n/simple_defs_de.php +++ presentations/slides/i18nl10n/simple_defs_de.php <?php define('SAMPLE_HELLO', 'Hoi'); define('SAMPLE_EX', 'Dass ist Beispiel Nummer %d!'); ?> Index: presentations/slides/i18nl10n/simple_defs_en.php +++ presentations/slides/i18nl10n/simple_defs_en.php <?php define('SAMPLE_HELLO', 'Hey'); define('SAMPLE_EX', 'This is example number %d!'); ?> Index: presentations/slides/i18nl10n/simple_defs_ex.php +++ presentations/slides/i18nl10n/simple_defs_ex.php <?php switch ($argv[1]) { case 'de': include_once('./simple_defs_de.php'); break; case 'en': default: include_once('./simple_defs_en.php'); break; } print SAMPLE_HELLO; print "\n<br>\n"; print sprintf(SAMPLE_EX, 1); ?> Index: presentations/slides/i18nl10n/simple_ex.xml +++ presentations/slides/i18nl10n/simple_ex.xml <slide title="Simple i18n Example"> <blurb> First create a default definition file. </blurb> <example filename="simple_defs_en.php" fontsize="1.2em" type="php"/> <blurb> Then create your PHP script which utilizes those defines. </blurb> <example filename="simple_defs_ex.php" fontsize="1.2em" type="php"/> <blurb> Then copy over your english translation to the language translation you wish to make (in this case German). </blurb> <example fontsize="1.2em" type="shell"> ]$ cp sample_defs_en.php sample_defs_de.php </example> <blurb> And then edit the file, with the desired translations. </blurb> <example filename="simple_defs_de.php" fontsize="1.2em" type="php"/> </slide> Index: presentations/slides/i18nl10n/thanks.xml +++ presentations/slides/i18nl10n/thanks.xml <slide title="Thank You"> <blurb fontsize="4.0em"> Thank you very much for coming. &lt;br /&gt; &lt;br /&gt; </blurb> <link align="center" leader="You can find these slides online at " href="http://conf.php.net/"/> </slide> Index: presentations/slides/i18nl10n/titlepage.xml +++ presentations/slides/i18nl10n/titlepage.xml <slide fontsize="3.5em"> <title>Welcome!</title> <blurb align="center" fontsize="6.0em">Techniques with Internationalization and Localization</blurb> <blurb align="center" fontsize="4.0em">International PHP Conference</blurb> <blurb align="center">Nov 05, 2002</blurb> <link align="center" leader="Sterling Hughes, " href="sterling@php.net"/> </slide> Index: presentations/slides/i18nl10n/visitation1.xml +++ presentations/slides/i18nl10n/visitation1.xml <?xml version="1.0" encoding="ISO-8859-1"?> <slide fontsize="6em"> <title>Visitation model 1</title> <blurb fontsize="5em">Directory structure:</blurb> <image align="center" filename="yahoo.png" /> <blurb fontsize="5em">Stored as: <![CDATA[<table class="db" border="1" align="center" cellspacing="0"> <tr> <th>Id</th><th>Parent</th><th>Name</th> </tr> <tr> <td>3</td><td>1</td><td class="left">Countries</td> </tr> <tr> <td>4</td><td>3</td><td class="left">Belgium</td> </tr> <tr> <td>5</td><td>3</td><td class="left">Netherlands</td> </tr> <tr> <td>6</td><td>3</td><td class="left">Germany</td> </tr> <tr> <td>7</td><td>5</td><td class="left">Business and Economy</td> </tr> </table> ]]></blurb> <blurb fontsize="5em">Retrieve list with:</blurb> <example fontsize="1.1em"><![CDATA[<?php function gimmeParent($id) { global $dir; $res = mysql_query("SELECT parent, name FROM directory WHERE id = $id"); if (mysql_num_rows($res) > 0) { $dir[] = ($row = mysql_fetch_row($res)); gimmeParent($row['parent']); } } gimmeParent(7); ?>]]></example> </slide> Index: presentations/slides/i18nl10n/visitation2.xml +++ presentations/slides/i18nl10n/visitation2.xml <?xml version="1.0" encoding="ISO-8859-1"?> <slide fontsize="6em"> <title>Visitation model 2</title> <blurb fontsize="4em">Tree structure:</blurb> <image align="center" filename="tree1.png" /> <blurb> </blurb> <blurb> </blurb> <blurb> </blurb> <blurb> </blurb> <blurb fontsize="4em">Visitation:</blurb> <image align="center" filename="tree2.png" /> <blurb fontsize="4em">Stored as: <![CDATA[<table class="db" border="1" align="center" cellspacing="0"> <tr> <th>Id</th><th>Parent</th><th>Name</th><th>Left</th><th>Right</th> </tr> <tr> <td>3</td><td>1</td><td class="left">Countries</td><td>1</td><td>12</td> </tr> <tr> <td>4</td><td>3</td><td class="left">Belgium</td><td>2</td><td>3</td> </tr> <tr> <td>5</td><td>3</td><td class="left">Netherlands</td><td>4</td><td>9</td> </tr> <tr> <td>6</td><td>3</td><td class="left">Germany</td><td>10</td><td>11</td> </tr> <tr> <td>7</td><td>5</td><td class="left">Business</td><td>5</td><td>6</td> </tr> <tr> <td>8</td><td>5</td><td class="left">Economy</td><td>7</td><td>8</td> </tr> </table> ]]></blurb> </slide> Index: presentations/slides/i18nl10n/visitation3.xml +++ presentations/slides/i18nl10n/visitation3.xml <?xml version="1.0" encoding="ISO-8859-1"?> <slide fontsize="6em"> <title>Visitation model 3</title> <blurb> </blurb> <blurb fontsize="5em">Select the path:</blurb> <image align="center" filename="tree3.png" /> <blurb fontsize="5em">Query:</blurb> <example fontsize="2em"><![CDATA[SELECT * FROM directory WHERE left < 5 AND right > 6]]></example> </slide> Index: presentations/slides/i18nl10n/visitation4.xml +++ presentations/slides/i18nl10n/visitation4.xml <?xml version="1.0" encoding="ISO-8859-1"?> <slide fontsize="6em"> <title>Visitation model 4</title> <blurb> </blurb> <blurb fontsize="5em">Select all end points:</blurb> <image align="center" filename="tree4.png" /> <blurb fontsize="5em">Query:</blurb> <example fontsize="2em"><![CDATA[SELECT * FROM directory WHERE right - left = 1]]></example> </slide> Index: presentations/slides/i18nl10n/visitation5.xml +++ presentations/slides/i18nl10n/visitation5.xml <?xml version="1.0" encoding="ISO-8859-1"?> <slide fontsize="6em"> <title>Visitation model 5</title> <blurb> </blurb> <blurb fontsize="5em">Select a subtree:</blurb> <image align="center" filename="tree5.png" /> <blurb fontsize="5em">Query:</blurb> <example fontsize="2em"><![CDATA[SELECT * FROM directory WHERE left > 4 AND right < 9]]></example> </slide>
« previous php.pres (#486) next »