<?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>Learning FLOW3 &#187; Google Summer of Code 2010</title>
	<atom:link href="http://flow3.gusak.eu/category/google-summer-of-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://flow3.gusak.eu</link>
	<description>Tutorials and examples for FLOW3 beginners</description>
	<lastBuildDate>Tue, 17 Aug 2010 16:22:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>GSoC 2010 – finished! – general summary</title>
		<link>http://flow3.gusak.eu/2010/08/gsoc-2010-%e2%80%93-finished-%e2%80%93-general-summary/</link>
		<comments>http://flow3.gusak.eu/2010/08/gsoc-2010-%e2%80%93-finished-%e2%80%93-general-summary/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 16:22:25 +0000</pubDate>
		<dc:creator>Karol Gusak</dc:creator>
				<category><![CDATA[Google Summer of Code 2010]]></category>
		<category><![CDATA[Various FLOW3 Topics]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[summary]]></category>

		<guid isPermaLink="false">http://flow3.gusak.eu/?p=159</guid>
		<description><![CDATA[Yesterday (16.08.2010) Google Summer of Code 2010 has finished. It was great experience for me and I&#8217;m very thankful for being allowed to participate. I&#8217;ve learned many new things and I definitely improved my programming skills. I&#8217;m also happy because part of my work will hopefully be present in a web application framework which I [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday (16.08.2010) Google Summer of Code 2010 <a href="http://socghop.appspot.com/document/show/gsoc_program/google/gsoc2010/timeline">has finished</a>. It was great experience for me and I&#8217;m very thankful for being allowed to participate. I&#8217;ve learned many new things and I definitely improved my programming skills. I&#8217;m also happy because part of my work will hopefully be present in a web application framework which I believe will become very important and popular in near future.</p>
<p>In general, I completed most of the tasks from my <a href="http://gusak.eu/resources/pdf/gsoc2010_proposal_flow3_i18n.pdf">proposal</a>, but not all of them. Some (many) details changed during implementation, became harder than I thought, while others were simpler. I won&#8217;t get into details (there are plenty of <a href="http://flow3.gusak.eu/category/google-summer-of-code/">week summaries</a> for that purpose ;-) ), I&#8217;d only like to mention that I&#8217;m looking forward to participating in the FLOW3 project in my free time.</p>
<p>I would like to especially thank my mentor <a href="http://k-fish.de/">Karsten Dambekalns</a> for all the help he provided me during the coding period, and much earlier too. Also I&#8217;d like to thank the members of TYPO3 community for support during GSoC and for making great software, which FLOW3 is, available as open source! You rock! :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://flow3.gusak.eu/2010/08/gsoc-2010-%e2%80%93-finished-%e2%80%93-general-summary/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>GSoC 2010 – week summary: August 9th – August 15th</title>
		<link>http://flow3.gusak.eu/2010/08/gsoc-2010-%e2%80%93-week-summary-august-9th-%e2%80%93-august-15th/</link>
		<comments>http://flow3.gusak.eu/2010/08/gsoc-2010-%e2%80%93-week-summary-august-9th-%e2%80%93-august-15th/#comments</comments>
		<pubDate>Sun, 15 Aug 2010 18:58:15 +0000</pubDate>
		<dc:creator>Karol Gusak</dc:creator>
				<category><![CDATA[Google Summer of Code 2010]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[summary]]></category>

		<guid isPermaLink="false">http://flow3.gusak.eu/?p=145</guid>
		<description><![CDATA[I continued the code cleaning this week. My goal was to remove all &#8220;magic strings&#8221; &#8211; places where few different string values are accepted as parameter. I created bunch of constants in appropriate classes, and added value checking where needed, so it&#8217;s now clear what values can be passed to methods.
After that I returned to [...]]]></description>
			<content:encoded><![CDATA[<p>I <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4950">continued</a> the code cleaning this week. My goal was to remove all &#8220;magic strings&#8221; &#8211; places where few different string values are accepted as parameter. I created bunch of constants in appropriate classes, and added value checking where needed, so it&#8217;s now clear what values can be passed to methods.</p>
<p>After that I <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4952">returned</a> to the <code>Validators</code> which I were writing last week &#8211; <code>NumberValidator</code> and <code>DateTimeValidator</code>. They both accepts additional options: <code>locale</code>, <code>strictMode</code> (to work in strict or lenient matching), <code>formatType</code>, <code>formatLength</code>. These options are closely related to the arguments accepted by <code>Parsers</code> (<code>NumberParser</code> and <code>DatetimeParser</code>), as <code>Validators</code> use them to do their job.</p>
<p>Currently I&#8217;m still working on the <em>Internationalization and Localization</em> chapter for FLOW3 documentation. Its almost finished &#8211; I just need to format the text nicely ;-). XML Mind is very convenient tool for writing DocBooks.</p>
<p>Well, this is the last week summary as tomorrow is the day when GSoC coding period ends. I&#8217;m very glad for being able to participate in such great open source project like FLOW3. It was great time for me. But let&#8217;s not hijack a week summary post! I will write separate post about the GSoC &#038; FLOW3 seen from my point of view very soon! :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://flow3.gusak.eu/2010/08/gsoc-2010-%e2%80%93-week-summary-august-9th-%e2%80%93-august-15th/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>GSoC 2010 – week summary: August 2nd – August 8th</title>
		<link>http://flow3.gusak.eu/2010/08/gsoc-2010-%e2%80%93-week-summary-august-2nd-%e2%80%93-august-8th/</link>
		<comments>http://flow3.gusak.eu/2010/08/gsoc-2010-%e2%80%93-week-summary-august-2nd-%e2%80%93-august-8th/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 17:36:05 +0000</pubDate>
		<dc:creator>Karol Gusak</dc:creator>
				<category><![CDATA[Google Summer of Code 2010]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[summary]]></category>

		<guid isPermaLink="false">http://flow3.gusak.eu/?p=136</guid>
		<description><![CDATA[This week I decided to do the code cleaning. I reviewed each and every file and improved naming, comments, and other minor readability issues. I also largely modified some tests, mainly older ones where I&#8217;ve been using bad approach to test cases (named like &#8220;methodNameWorks()&#8221; ;-)). I also improved code coverage (it&#8217;s now way more [...]]]></description>
			<content:encoded><![CDATA[<p>This week I decided to do the code cleaning. I reviewed <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4933">each</a> <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4947">and</a> <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4949">every</a> file and improved naming, comments, and other minor readability issues. I also largely modified some tests, mainly older ones where I&#8217;ve been using bad approach to test cases (named like &#8220;<code>methodNameWorks()</code>&#8221; ;-)). I also improved code coverage (it&#8217;s now way more than 80%). I realized that it&#8217;s good to read my own code after a while because I can then catch out some unclear naming issues and strange descriptions, which appeared to be understandable back when I was writing them :-).</p>
<p>I planned to create the <code>Validators</code> this week and I even have some code in my working copy, but I need more time. As the <code>Parsers</code> created earlier provide pretty useful functionality, I would like to support all of it in <code>Validators</code> using <code>options</code> property of <code>AbstractValidator</code> class. Initially I wanted to do quite a few simple <code>Validators</code> (like <code>DecimalNumberValidator</code>, <code>PercentNumberValidator</code>, and similar for date and time), but now I think that two classes (<code>NumberValidator</code> and <code>DatetimeValidator</code>) with options for configuring how they work will be a better solution.</p>
<p>I also need to remove few more issues (like magic strings as parameters, and lack of validation for these &#8211; why PHP still has no Enum type?).</p>
<p>There is a pencils down deadline after the next week (August 16th). I won&#8217;t be allowed to write any more code after. Fortunately almost everything what I planned to do and what I described in my proposal is done. I will write a nice documentation chapter and all should be OK ;-).</p>
]]></content:encoded>
			<wfw:commentRss>http://flow3.gusak.eu/2010/08/gsoc-2010-%e2%80%93-week-summary-august-2nd-%e2%80%93-august-8th/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>GSoC 2010 – week summary: July 26th – August 1st</title>
		<link>http://flow3.gusak.eu/2010/08/gsoc-2010-%e2%80%93-week-summary-july-26th-%e2%80%93-august-1st/</link>
		<comments>http://flow3.gusak.eu/2010/08/gsoc-2010-%e2%80%93-week-summary-july-26th-%e2%80%93-august-1st/#comments</comments>
		<pubDate>Sun, 01 Aug 2010 15:52:15 +0000</pubDate>
		<dc:creator>Karol Gusak</dc:creator>
				<category><![CDATA[Google Summer of Code 2010]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[summary]]></category>

		<guid isPermaLink="false">http://flow3.gusak.eu/?p=124</guid>
		<description><![CDATA[I started this week with various code improvements / cleaning (r4910). Then I moved the formatting functionality from classes NumbersReader and DatesReader to NumberFormatter and DatetimeFormatter accordingly (r4913, r4920). I didn&#8217;t do this earlier as I wanted to encapsulate all CLDR-specific code in Readers, but when I started to work on Parsers it came obvious [...]]]></description>
			<content:encoded><![CDATA[<p>I started this week with various code improvements / cleaning (<a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4910">r4910</a>). Then I moved the formatting functionality from classes <code>NumbersReader</code> and <code>DatesReader</code> to <code>NumberFormatter</code> and <code>DatetimeFormatter</code> accordingly (<a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4913">r4913</a>, <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4920">r4920</a>). I didn&#8217;t do this earlier as I wanted to encapsulate all CLDR-specific code in <code>Readers</code>, but when I started to work on <code>Parsers</code> it came obvious that with this policy the <code>Readers</code> classes will be pretty fat. So now <code>Readers</code> can read and parse particular CLDR data, while <code>Formatters</code> and <code>Parses</code> uses <code>Readers'</code> API for formatting / parsing (they use parsed number / datetime format patterns, to be precise).</p>
<p>This week was full of frequent, small commits (two more I didn&#8217;t mention: <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4916">r4916</a>, <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4922">r4922</a>). But the most important task was the lenient parsing (<code>NumberParser</code>: <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4925">r4925</a>, <code>DatetimeParser</code>: <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4928">4928</a>).</p>
<p>This is not a full featured lenient parsing as described in some documents on the Internet, it&#8217;s rather a &#8220;light&#8221; variant. But I&#8217;m pretty happy with results and I think that both strict and lenient mode complements each other nicely. Strict parsing is meant to be used when pattern needs to be matched exactly (even whitespace counts :-) ), while lenient parsing ignores everything that can be ignored in order to extract important elements from the string.</p>
<p>I rewrote the tests for parsers in order to test both parsing modes thoroughly. You can see in these tests that when strict mode fails and returns FALSE, lenient mode does just fine :-).</p>
<p>I gathered significant list of various code-cleaning tasks in my FLOW3 TODO file ;-), so I plan to review my code extensively next week. I will also implement some <code>Validators</code> for FLOW3 Validation subsystem (they will use <code>NumberParser</code> and <code>DatetimeParser</code> to do the job).</p>
]]></content:encoded>
			<wfw:commentRss>http://flow3.gusak.eu/2010/08/gsoc-2010-%e2%80%93-week-summary-july-26th-%e2%80%93-august-1st/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GSoC 2010 – week summary: July 19th – July 25th</title>
		<link>http://flow3.gusak.eu/2010/07/gsoc-2010-%e2%80%93-week-summary-july-19th-%e2%80%93-july-25th/</link>
		<comments>http://flow3.gusak.eu/2010/07/gsoc-2010-%e2%80%93-week-summary-july-19th-%e2%80%93-july-25th/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 12:14:58 +0000</pubDate>
		<dc:creator>Karol Gusak</dc:creator>
				<category><![CDATA[Google Summer of Code 2010]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[summary]]></category>

		<guid isPermaLink="false">http://flow3.gusak.eu/?p=117</guid>
		<description><![CDATA[This week I was working on the parsers: NumberParser and DatetimeParser. When I&#8217;ve decided how should they look I started to implement them. Parsers will have two modes of work: strict and lenient. In strict mode, parser tries to match elements of provided string exactly as they are defined in the format (pattern). In lenient [...]]]></description>
			<content:encoded><![CDATA[<p>This week I was working on the parsers: <code>NumberParser</code> and <code>DatetimeParser</code>. When I&#8217;ve decided how should they look I started to implement them. Parsers will have two modes of work: strict and lenient. In strict mode, parser tries to match elements of provided string exactly as they are defined in the format (pattern). In lenient mode parser will try to do it&#8217;s best in order to read the value.</p>
<p>I managed to implement the strict modes for both <code>NumberParser</code> and <code>DatetimeParser</code> (<a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4903">r4903</a>). They use parsed formats accordingly from <code>NumbersReader</code> and <code>DatesReader</code>, and try to match particular elements of the format. If something goes wrong, <code>FALSE</code> is returned.</p>
<p><code>Parses</code> do not follow full specification of CLDR for numbers and datetime, as <code>Readers</code> don&#8217;t do it either. But the most important features are supported.</p>
<p>Next week I will improve some parts of existing code (especially <code>DatetimeParser</code> as I have some ideas, and I think I will change <code>Readers</code> too). Also, the tests for parsers need to be extended. Then I will work on the lenient parsing in order to provide at least a little bit of loose matching.</p>
<p>According to the timeline less than 4 weeks of GSoC left. When I finish the parsers, I will work on the number and datetime <code>Validators</code> for FLOW3. After that, if all goes right I will have almost 2 weeks for documentation and for improvements in various parts of the code. For example, I need to think about the Translate Fluid viehelper (Bastian <a href="http://forge.typo3.org/issues/8901#change-20599">helped me</a> with this a lot, thank you!).</p>
]]></content:encoded>
			<wfw:commentRss>http://flow3.gusak.eu/2010/07/gsoc-2010-%e2%80%93-week-summary-july-19th-%e2%80%93-july-25th/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>GSoC 2010 – week summary: July 12th – July 18th</title>
		<link>http://flow3.gusak.eu/2010/07/gsoc-2010-%e2%80%93-week-summary-july-12th-%e2%80%93-july-18th/</link>
		<comments>http://flow3.gusak.eu/2010/07/gsoc-2010-%e2%80%93-week-summary-july-12th-%e2%80%93-july-18th/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 11:30:32 +0000</pubDate>
		<dc:creator>Karol Gusak</dc:creator>
				<category><![CDATA[Google Summer of Code 2010]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[summary]]></category>

		<guid isPermaLink="false">http://flow3.gusak.eu/?p=103</guid>
		<description><![CDATA[Translator
I implemented the Translator class this week. The Translator class is meant to be used for messages&#8217; translation (of course ;-)), and it has pretty interesting functionality. This class is a place where almost all functionality I wrote up to today meets.
First of all, the Translator has two modes of operation: translating by original label, [...]]]></description>
			<content:encoded><![CDATA[<h3>Translator</h3>
<p>I implemented the <code><a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4847">Translator</a></code> class this week. The <code>Translator</code> class is meant to be used for messages&#8217; translation (of course ;-)), and it has pretty interesting functionality. This class is a place where almost all functionality I wrote up to today meets.</p>
<p>First of all, the <code>Translator</code> has two modes of operation: translating by original label, and by ID.</p>
<ul>
<li><b>by original label</b> &#8211; searching for translated label is done for original (untranslated) label</li>
<li><b>by ID</b> &#8211; searching is done for particular identification key</li>
</ul>
<p>These modes seem to be very similar (as original label and ID are just used as a key), but there is an important difference between them. In general, placing untranslated labels in view templates is more readable (for example, &#8220;Y<em>ou should log in before doing this action</em>&#8221; is better than &#8220;<em>user.notLoggedIn</em>&#8220;). But using IDs is probably more maintainable. So the <code>Translator</code> has API for both modes, but whether they are both supported depends on translation provider class used by <code>Translator</code>.</p>
<p>The translation provider is a class which implements <code>TranslationProviderInterface</code> (described in <a href="http://flow3.gusak.eu/2010/07/gsoc-2010-%E2%80%93-week-summary-july-5th-%E2%80%93-july-11th/">previous summary</a>). Concrete provider doesn&#8217;t have to support two modes. The default provider, <code>XliffTranslationProvider</code>, supports both modes as either source labels and IDs are stored in XLIFF files.</p>
<p><code>Translator</code> requires a <code>$source</code> parameter to be set for every use of <code>translate*()</code> methods. Source is a string identifier understandable by translation provider which uniquely denotes a source catalog of translation labels to use. For <code>XliffTranslationProvider</code>, it&#8217;s just a name of XLIFF file.</p>
<p>I think that source parameter should be optional, set by default to &#8220;<em>main</em>&#8221; for example, as defining it for every method call is pretty redundant. This needs to be discussed by core devs though.</p>
<p><code>Translator</code> supports plural forms. In order to use them, you need to set the <code>$quantity</code> parameter. It is a number (integer or float, unsigned) used for evaluating a plural-form expression defined for particular language. Of course, the source label has to be translated into all plural forms used in the target language.</p>
<p>It is also worth to note, that when plural forms are used together with the &#8220;<em>by original label</em>&#8221; translation mode, you need to use singular form for source message. It will be translated to correct plural form if feasible. Please note that it is a subject to change as for example avoiding translation (when source and target language are the same) is not done yet.</p>
<p>The <code>Translator</code> class also uses the <code><a href="http://flow3.gusak.eu/2010/07/gsoc-2010-%E2%80%93-3-weeks-summary-june-14th-%E2%80%93-july-4th/">FormatResolver</a></code> for substituting placeholders with formatted values. So you can define a placeholder (like <code>{0,number}</code>) and provide array of values, and they will be formatted and inserted into translated label.</p>
<h3>TranslateViewHelper</h3>
<p>I also committed preliminary version of the <code><a href="http://forge.typo3.org/projects/package-viewhelperincubator/repository/revisions/4867">TranslateViewHelper</a></code>, a view helper for Fluid templating system. It is kind of a wrapper for <code>Translator</code> class, and is also subject to change. Some usage examples:</p>
<pre class="brush: xml; light: true;">
&lt;f:translate mode=&quot;originalLabel&quot; source=&quot;main&quot;&gt;Untranslated label&lt;/f:translate&gt;
&lt;f:translate mode=&quot;originalLabel&quot; source=&quot;someLabelsCatalog&quot; locale=&quot;de_DE&quot;&gt;Untranslated label&lt;/f:translate&gt;
&lt;f:translate mode=&quot;originalLabel&quot; source=&quot;main&quot; values=&quot;{0: 'foo', 1: '99.9'}&quot;&gt;Untranslated {0} and {1,number}&lt;/f:translate&gt;
&lt;f:translate mode=&quot;id&quot; source=&quot;main&quot;&gt;user.unregistered&lt;/f:translate&gt;
</pre>
<h3>Other</h3>
<p>Robert <a href="http://forge.typo3.org/issues/8772">decided</a> to rename the <code>Locale</code> subpackage I&#8217;m working on to <code>I18n</code>, as it is better name for the functionality it will provide. <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4851">So</a> <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4852">I did</a> <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4855">it</a>, breaking things in other subpackages by the way :-). Fortunately Karsten was near and <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4860">fixed all of them</a>.</p>
<p>I also <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4850">fixed</a> <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4859">few</a> <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4856">bugs</a> Bastian noticed, providing me good advices. Thank you!</p>
<p>By the end of this week I was thinking about the next task, a locale-aware input parser for date/time and for numbers. This is my goal for next two weeks, and I hope I will be able to provide a nice solution. Parsing user input can be very hard task. I read about Lenient Parsing. There will probably be few modes of operation, eg. &#8220;strict&#8221; and &#8220;loose&#8221;. We will see ;-).</p>
]]></content:encoded>
			<wfw:commentRss>http://flow3.gusak.eu/2010/07/gsoc-2010-%e2%80%93-week-summary-july-12th-%e2%80%93-july-18th/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>GSoC 2010 – week summary: July 5th – July 11th</title>
		<link>http://flow3.gusak.eu/2010/07/gsoc-2010-%e2%80%93-week-summary-july-5th-%e2%80%93-july-11th/</link>
		<comments>http://flow3.gusak.eu/2010/07/gsoc-2010-%e2%80%93-week-summary-july-5th-%e2%80%93-july-11th/#comments</comments>
		<pubDate>Sun, 11 Jul 2010 11:51:15 +0000</pubDate>
		<dc:creator>Karol Gusak</dc:creator>
				<category><![CDATA[Google Summer of Code 2010]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[summary]]></category>

		<guid isPermaLink="false">http://flow3.gusak.eu/?p=89</guid>
		<description><![CDATA[This week I was working on the message translation feature. I implemented XLIFF file format support. XLIFF is standardized XML format for storing translated messages (labels). There are few translation tools available that support this format (some are still beta though), but there are also converters from/to widely known Gettext&#8217;s PO file format.
As Gettext natively [...]]]></description>
			<content:encoded><![CDATA[<p>This week I was working on the message translation feature. I implemented <a href="http://en.wikipedia.org/wiki/XLIFF">XLIFF</a> file format support. XLIFF is standardized XML format for storing translated messages (labels). There are few translation tools available that support this format (some are still beta though), but there are also converters from/to widely known <a href="http://en.wikipedia.org/wiki/Gettext">Gettext</a>&#8217;s PO file format.</p>
<p>As Gettext natively supports plural forms, and XLIFF does not (it can be done in many ways), I decided to take it into account during XLIFF parser implementation. There is a <a href="http://docs.oasis-open.org/xliff/v1.2/xliff-profile-po/xliff-profile-po-1.2-cd02.html#s.detailed_mapping.tu">specification</a> defining how the conversion from .po to .xlf should be done (with plurals), and it&#8217;s what the parser conforms. I think it&#8217;s the best way for storing plural forms in XLIFF files, as it is possible to convert .xlf to .po, edit it using .po editor (like very good <a href="http://www.poedit.net/">Poedit</a>), and then convert it back to .xlf without any data loss. There is the <a href="translate.sourceforge.net/">Translate Toolkit</a> project which has good converters.</p>
<p>However, the way how Gettext defines plural forms is different to the method used in CLDR. In .po files, you just write a C language expression in header which evaluates to integer number, and this number is an index of plural form. In CLDR, there are separate expressions for every form.</p>
<p>Example from Gettext&#8217;s .po file (for Polish language):</p>
<pre class="brush: plain; light: true;">&quot;Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10&gt;=2 &amp;&amp; n%10&lt;=4 &amp;&amp; (n%100&lt;10 || n%100&gt;=20) ? 1 : 2);\n&quot;</pre>
<p>And the message is defined like this:</p>
<pre class="brush: plain; light: true;">msgid &quot;Source singular&quot;
msgid_plural &quot;Source plural&quot;
msgstr[0] &quot;Translated singular&quot;
msgstr[1] &quot;Translated plural 1&quot;
msgstr[2] &quot;Translated plural 2&quot;
</pre>
<p>When you convert this to .xlf file, it looks as follow (unimportant tags were stripped):</p>
<pre class="brush: xml; light: true;">
&lt;?xml version='1.0' encoding='utf-8'?&gt;
&lt;xliff xmlns=&quot;urn:oasis:names:tc:xliff:document:1.1&quot; version=&quot;1.1&quot;&gt;
  &lt;file original=&quot;foo.po&quot; source-language=&quot;en-US&quot; datatype=&quot;po&quot;&gt;
    &lt;body&gt;
      &lt;group restype=&quot;x-gettext-plurals&quot; id=&quot;1&quot; xml:space=&quot;preserve&quot;&gt;
        &lt;trans-unit id=&quot;1[0]&quot;&gt;
          &lt;source&gt;Source singular&lt;/source&gt;
          &lt;target&gt;Translated singular&lt;/target&gt;
        &lt;/trans-unit&gt;
        &lt;trans-unit id=&quot;2[1]&quot;&gt;
          &lt;source&gt;Source plural&lt;/source&gt;
          &lt;target&gt;Translated plural 1&lt;/target&gt;
        &lt;/trans-unit&gt;
        &lt;trans-unit id=&quot;3[2]&quot;&gt;
          &lt;source&gt;Source plural&lt;/source&gt;
          &lt;target&gt;Translated plural 2&lt;/target&gt;
        &lt;/trans-unit&gt;
      &lt;/group&gt;
    &lt;/body&gt;
  &lt;/file&gt;
&lt;/xliff&gt;
</pre>
<p>In CLDR, there are no indices, but keys: &#8220;one&#8221;, &#8220;zero&#8221;, &#8220;two&#8221;, &#8220;few&#8221;, &#8220;many&#8221;, &#8220;other&#8221;. Particular language uses only subset of these keys. I simplified this and the keys are mapped to indices for particular language. For example, if language has &#8220;one&#8221;, &#8220;few&#8221;, and &#8220;many&#8221; forms (like Polish), they are mapped to 0, 1, and 2, so correct form is chosen from XLIFF file, and automatic .po &#8211; .xlf conversion is possible.</p>
<p>The <em>Translator</em> class (which is not done yet) will use implementations of <em>TranslationProviderInterface</em> in order to translate strings. I implemented only one concrete translation provider (the <em>XliffTranslationProvider</em>), but it will be easy to add other providers, to support different file formats (or even other storage methods).</p>
<p>When implementing the XLIFF parser, I noticed that some class hierarchy could be improved. Actually, the <em>CldrModel</em> written few weeks earlier was an abstract for XML file, same as the <em>XliffModel</em> which I created this week. So I created an abstract class, <em>AbstractXmlModel</em>, which is common base for former two classes. Also, they all use parsers in order to convert CLDR or XLIFF file to an internal representation. So there is now an <em>AbstractXmlParser</em>, from which <em>CldrParser</em> and <em>XliffParser</em> extends. I think it reduced the redundant code quite a lot.</p>
<p>Then I came up with &#8220;brilliant&#8221; idea to get it even further and make <em>HierarchicalCldrModel</em> extend <em>CldrModel</em>, and change the readers (<em>DatesReader</em>, <em>PluralsReader</em>, <em>NumbersReader</em>) so they are models extending <em>HierarchicalCldrModel</em>. When I was almost done I realized that it complicated things and the hierarchy was vague, so I reverted it all back ;-).</p>
<p>This weeks&#8217; changes were commited in <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4827">r4827</a>.</p>
<p>Next week I will implement <em>Translator</em> class, and Fluid Viewhelper for message translation feature. Then the next important feature to do will be an input parsing, and validators. So far, I&#8217;m good with my proposal&#8217;s timeline ;-).</p>
]]></content:encoded>
			<wfw:commentRss>http://flow3.gusak.eu/2010/07/gsoc-2010-%e2%80%93-week-summary-july-5th-%e2%80%93-july-11th/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>GSoC 2010 – 3 weeks summary: June 14th – July 4th</title>
		<link>http://flow3.gusak.eu/2010/07/gsoc-2010-%e2%80%93-3-weeks-summary-june-14th-%e2%80%93-july-4th/</link>
		<comments>http://flow3.gusak.eu/2010/07/gsoc-2010-%e2%80%93-3-weeks-summary-june-14th-%e2%80%93-july-4th/#comments</comments>
		<pubDate>Sun, 04 Jul 2010 14:59:40 +0000</pubDate>
		<dc:creator>Karol Gusak</dc:creator>
				<category><![CDATA[Google Summer of Code 2010]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[summary]]></category>

		<guid isPermaLink="false">http://flow3.gusak.eu/?p=78</guid>
		<description><![CDATA[This summary is a little bit unusual as it summaries 3 weeks and not 1 :-). This was pretty busy time for me at univ as with the end of the semester few projects and exams were need to be done / taken. So I focused on these and informed my mentor that I will [...]]]></description>
			<content:encoded><![CDATA[<p>This summary is a little bit unusual as it summaries 3 weeks and not 1 :-). This was pretty busy time for me at univ as with the end of the semester few projects and exams were need to be done / taken. So I focused on these and informed my mentor that I will catch up when holidays begin. So I&#8217;m doing it right now ;-).</p>
<p>During the end-of-semester period I managed to do simple things. I <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4606">refactored some classes</a> in order to conform FLOW3 Coding Guidelines, <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4609">updated</a> <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4610">CLDR version</a> in FLOW3 package, did more <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4611">minor code refactoring</a>. All of the tasks were Karsten&#8217;s notices / suggestions.</p>
<p>With the beginning of July my holidays started, so I focused on GSoC project. The most important part I implemented was message formatting (<a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4694">r4694</a>). These classes will be responsible for formatting messages (labels, strings), or to be more precise, replacing the &#8220;placeholders&#8221; in these messages with formatted values (numbers, date/time, etc). Placeholders have very simple syntax and look like this:</p>
<ul>
<li><strong>{0}</strong>, <strong>{1}</strong> etc &#8211; Places string-casted version of a value (number in brackets defines the value&#8217;s index from values array provided)</li>
<li><strong>{0,number,decimal}</strong> or <strong>{0,number}</strong> &#8211; Format as decimal number using pattern from CLDR defined for current locale</li>
<li><strong>{0,datetime}</strong> &#8211; Format as date and time</li>
<li><strong>{0,datetime,time,full}</strong> &#8211; Format only time part, choose the &#8220;full&#8221; version of pattern from CLDR</li>
</ul>
<p>Second element in the placeholder defines name of formatter to use. Remaining elements are passed directly to the formatter (for example, <em>NumberFormatter</em> uses only one additional element, defining if format value as decimal, or percentage, but <em>DatetimeFormatter</em> accepts two elements &#8211; style (datetime, date or time) and length (full, long, medium, short).</p>
<p><em>DatetimeFormatter</em> is still subject to change (as you can see, there is some duplication in placeholders, when you write <strong>{0,datetime,time,full}</strong>, it would be nicer to write <strong>{0,time,full}</strong>. But this can be changed very easily as formatters are simple classes implementing <em>FormatterInterface</em>, and are automatically loaded if needed.</p>
<p>Formatter classes are the place where the data from CLDR is used. Numbers and date / time are formatted with rules from CLDR.</p>
<p>I managed to do <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4695">few</a> <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4696">more</a> <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4697">commits</a> this week (improved exception hierarchy in Locale, defined public API as Karsten suggested, but it&#8217;s not finished yet of course), but I didn&#8217;t manage to commit changes I have in my working copy right now. It&#8217;s still a lot to be done but I think it will be pretty important commit which will clear up any concerns about the classes already done and how the Locale subpackage is meant to be used. </p>
<p>What I&#8217;m doing right now is the <em>Translator</em> class which will translate texts (also using the information about plural forms). But this class needs some kind of messages repository. I&#8217;m implementing <a href="http://en.wikipedia.org/wiki/XLIFF">XLIFF</a> parser so messages will be stored in XLIFF files, but adding support for other file formats in the future will be pretty easy. The new code also imposed changes on older parts (mainly on <em>CLDRModel</em> etc) so I think the class hierarchy will be more robust now.</p>
]]></content:encoded>
			<wfw:commentRss>http://flow3.gusak.eu/2010/07/gsoc-2010-%e2%80%93-3-weeks-summary-june-14th-%e2%80%93-july-4th/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>GSoC 2010 – week summary: June 7th – June 13th</title>
		<link>http://flow3.gusak.eu/2010/06/gsoc-2010-%e2%80%93-week-summary-june-7th-%e2%80%93-june-13th/</link>
		<comments>http://flow3.gusak.eu/2010/06/gsoc-2010-%e2%80%93-week-summary-june-7th-%e2%80%93-june-13th/#comments</comments>
		<pubDate>Sun, 13 Jun 2010 17:51:50 +0000</pubDate>
		<dc:creator>Karol Gusak</dc:creator>
				<category><![CDATA[Google Summer of Code 2010]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[summary]]></category>

		<guid isPermaLink="false">http://flow3.gusak.eu/?p=71</guid>
		<description><![CDATA[My goal for this week was to implement a class for formatting date and / or time. I created a class DatesReader, which is, like NumbersReader and PluralsReader created before, kind of wrapper for particular tags of CLDR XML data, providing an API for using this data in FLOW3 framework.
DatesReader parses most data from dates [...]]]></description>
			<content:encoded><![CDATA[<p>My goal for this week was to implement a class for formatting date and / or time. I created a class <em>DatesReader</em>, which is, like <em>NumbersReader</em> and <em>PluralsReader</em> created before, kind of wrapper for particular tags of CLDR XML data, providing an API for using this data in FLOW3 framework.</p>
<p><em>DatesReader</em> parses most data from <em>dates</em> tag, that is: <em>months</em>, <em>days</em>, <em>quarters</em>, <em>dayPeriods</em>, <em>eras</em>, <em>dateFormats</em>, <em>timeFormats</em> and <em>dateTimeFormats</em>. The most important functionality of <em>DatesReader</em> is of course, date and time formatting. Syntax for date / time format defined in CLDR is pretty extensive (<a href="http://www.unicode.org/reports/tr35/#Date_Format_Patterns">see the specification</a>). Most of it is supported by <em>DatesReader</em> class. As in <em>NumbersReader</em>, the solution for dateTime formatting in <a href="http://www.yiiframework.com/">Yii Framework</a> was very useful, although I extended it, so the specification is supported even more precisely. These are examples of supported formats (one format per line):</p>
<pre class="brush: plain; light: true;">
yyyy.MM.dd G
HH:mm:ss zzz
EEE, MMM d, 'yy
hh o'clock a, zzzz
</pre>
<p>Formats are parsed and stored in cache. DatesReader can format date, time or dateTime (both date and time in one string) &#8211; it uses formats defined in CLDR for particular locale. It can also format dateTime using custom format pattern. This class uses <a href="http://pl2.php.net/manual/en/class.datetime.php">DateTime</a> PHP object as a representation of date and time.</p>
<p><em>DatesReader</em> was commited in <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4504">Revision 4504</a> (update: actually in <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4512">r4512</a> as I forgot to add new files :-)).</p>
<p>I also thoroughly changed CLDRModel class (and HierarchicalCLDRModel). First of all, parsing of CLDR data is changed &#8211; internal array generated from CLDR is now much simpler, which I found much more robust and useful. It was easier to support <em>alias</em> tag which is used in CLDR to point places where actual data is placed (in order to not duplicate data in different parts of XML file). I also changed API for CLDRModel, and I think it&#8217;s now more useful.</p>
<p><em>DatesReader</em> is the last of CLDR classes I planned to implement. CLDR is very extensive and a lot more data could be used, but I&#8217;m afraid I won&#8217;t have time for the rest of my proposal. So, now I will proceed to the next task, which is support for XLIFF files. XLIFF is a XML format for storing translation messages (labels). If I will have time at the end of coding period, I will return to CLDR.</p>
]]></content:encoded>
			<wfw:commentRss>http://flow3.gusak.eu/2010/06/gsoc-2010-%e2%80%93-week-summary-june-7th-%e2%80%93-june-13th/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>GSoC 2010 – week summary: May 31st – June 6th</title>
		<link>http://flow3.gusak.eu/2010/06/gsoc-2010-%e2%80%93-week-summary-may-31st-%e2%80%93-june-6th/</link>
		<comments>http://flow3.gusak.eu/2010/06/gsoc-2010-%e2%80%93-week-summary-may-31st-%e2%80%93-june-6th/#comments</comments>
		<pubDate>Sun, 06 Jun 2010 16:47:55 +0000</pubDate>
		<dc:creator>Karol Gusak</dc:creator>
				<category><![CDATA[Google Summer of Code 2010]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[summary]]></category>

		<guid isPermaLink="false">http://flow3.gusak.eu/?p=55</guid>
		<description><![CDATA[After implementing CLDR reader last week, I focused on various classes which would use data from Common Locale Data Repository.
I started with PluralsReader, a class which will be used in messages (labels) translation process. This class basically returns a form-name (a string, one of: zero, one, two, few, many, other) for a pair of locale [...]]]></description>
			<content:encoded><![CDATA[<p>After implementing CLDR reader last week, I focused on various classes which would use data from Common Locale Data Repository.</p>
<p>I started with <em>PluralsReader</em>, a class which will be used in messages (labels) translation process. This class basically returns a form-name (a string, one of: zero, one, two, few, many, other) for a pair of locale and number. In some languages form of noun depends on a number expressed in a sentence &#8211; for example, unit such as time or currency.  English has only two rules (forms &#8220;one&#8221; and &#8220;other&#8221;), for example:</p>
<pre class="brush: plain; light: true;">
form &quot;one&quot;: 1 day
form &quot;other&quot;: 0 days, 2 days, 5 days, ...
</pre>
<p>A rule used here is simple, and can be written like this:</p>
<pre class="brush: xml; light: true;">&lt;pluralRule count=&quot;one&quot;&gt;n is 1&lt;/pluralRule&gt;</pre>
<p>(it is actually how rules are defined in CLDR)</p>
<p>For other languages, rules can be very complicated:</p>
<pre class="brush: xml; light: true;">
&lt;pluralRules locales=&quot;hr ru sr uk be bs sh&quot;&gt;
    &lt;pluralRule count=&quot;one&quot;&gt;n mod 10 is 1 and n mod 100 is not 11&lt;/pluralRule&gt;
    &lt;pluralRule count=&quot;few&quot;&gt;n mod 10 in 2..4 and n mod 100 not in 12..14&lt;/pluralRule&gt;
    &lt;pluralRule count=&quot;many&quot;&gt;n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14&lt;/pluralRule&gt;
    &lt;!-- rest are plurals --&gt;
&lt;/pluralRules&gt;
</pre>
<p><em>PluralsReader</em> class can parse these rules and define which form should be used for particular number. I committed this class (among others related) in <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4399">Revision 4399</a>.</p>
<p>When I wrote plurals reader, I started with another, similar class &#8211; <em>NumbersReader</em>. This one is more complicated. It can format a number (float or integer) using a format string. Syntax of format strings (patterns) is defined in CLDR. It&#8217;s very flexible and pretty complicated.</p>
<p>I didn&#8217;t implement all features described in CLDR (or to be precise: in <a href="http://www.unicode.org/reports/tr35/#Number_Format_Patterns">Unicode Technical Standard #35</a>), although I wanted the <em>NumbersReader</em> to support as much of the syntax as possible. I came across a solution of similar problem in <a href="http://www.yiiframework.com/">Yii Framework</a> codebase &#8211; it was very good starting point for me.</p>
<p>These are examples of formats supported by <em>NumbersReader</em> (one format per line):</p>
<pre class="brush: plain; light: true;">
#,##0.###
##0%
#,##0.00
00000.0000
'#,##0.0;(#)
¤ #,##0.00;¤ #,##0.00-
#,##0.05
</pre>
<p><em>NumbersReader</em> class can parse format &#8211; it stores all parsed formats in the cache &#8211; and then can format a number using parsed representation of the format. It has methods for formatting decimal / percent / currency numbers (formats are extracted from CLDR). Formatting with custom format is also possible.</p>
<p><em>NumbersReader</em> was commited in <a href="http://forge.typo3.org/projects/package-flow3/repository/revisions/4445">Revision 4445</a>.</p>
<p>Next week I will work on similar <em>Reader</em> class for date and time. Hopefully I will also have time to do something with currency formatting &#8211; as for now, <em>NumbersReader</em> can format a value with currency sign, but it is simplified (just replacing currency placeholder with currency sign provided). CLDR has pretty extensive data for currencies.</p>
]]></content:encoded>
			<wfw:commentRss>http://flow3.gusak.eu/2010/06/gsoc-2010-%e2%80%93-week-summary-may-31st-%e2%80%93-june-6th/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

