<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>Derilicious&#187; Posts tagged with I18n &#8211; Page  &#8211; Derilicious</title> <atom:link href="http://derickng.com/posts/tag/i18n/feed" rel="self" type="application/rss+xml" /><link>http://derickng.com</link> <description>A blog on web development technicalities by Derick Ng</description> <lastBuildDate>Sun, 20 Dec 2009 12:18:03 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Extracting PO file with CakePHP I18n Shell</title><link>http://derickng.com/posts/6-extracting-po-file-with-cakephp-i18n-shell</link> <comments>http://derickng.com/posts/6-extracting-po-file-with-cakephp-i18n-shell#comments</comments> <pubDate>Sat, 05 Jul 2008 16:15:39 +0000</pubDate> <dc:creator>Derick Ng</dc:creator> <category><![CDATA[Uncategorized]]></category> <category><![CDATA[CakePHP]]></category> <category><![CDATA[I18n]]></category><guid
isPermaLink="false">http://derick.lyniq.com/?p=6</guid> <description><![CDATA[I have always been religiously wrapping __() and __n() around my texts knowing that it needs to be localized some day. Then it got to me that I never knew how to actually localize it! Out of curiosity,  I went ahead to extract the PO file using the I18n shell.
What it does is basically [...]]]></description> <content:encoded><![CDATA[<p>I have always been religiously wrapping <code>__()</code> and <code>__n()</code> around my texts knowing that it needs to be localized some day. Then it got to me that I never knew how to actually localize it! Out of curiosity,  I went ahead to extract the PO file using the I18n shell.</p><p>What it does is basically look through your entire app folder for files and within each file extract all instances of <code>__()</code> and gang, then grab the tokens necessarily for building the PO file. Now, this is where it gets picky.</p><pre class="brush: php">
// error! invalid marker content!
__(&#039;Delete post #&#039; . $id);
__n(&#039;comment&#039;, &#039;comments&#039;, $array[0]);
__n(&#039;comment&#039;, &#039;comments&#039;, $object-&gt;noOfComments());
__n(&#039;comment&#039;, &#039;comments&#039;, (int) $noOfComments);

// valid! it makes it easier to translate anyways
sprintf(__(&#039;Delete post #%d&#039;, true), $id);
// just $var will work, nothing funky
sprintf(__n(&#039;%d comment&#039;, &#039;%d comments&#039;, $noOfComments, true), $noOfComments);
</pre><p>So if you are thinking of using the I18n shell, you should take note that the text to be translated should really be one single <em>token</em>. Also, the generated file has an extension of .pot but it should really be renamed to .po instead since Cake expects .po files in the locale folder.</p> ]]></content:encoded> <wfw:commentRss>http://derickng.com/posts/6-extracting-po-file-with-cakephp-i18n-shell/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (user agent is rejected)
Database Caching 4/13 queries in 0.002 seconds using disk

Served from: derickng.com @ 2010-08-01 04:29:43 -->