<?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>nanoANT</title>
	<atom:link href="http://www.nanoant.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.nanoant.com</link>
	<description>Yet another self-employee site &#38; blog</description>
	<lastBuildDate>Fri, 13 Aug 2010 18:51:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>nanoANT creates LiveChat for Mac</title>
		<link>http://www.nanoant.com/apple/nanoant-creates-livechat-for-mac</link>
		<comments>http://www.nanoant.com/apple/nanoant-creates-livechat-for-mac#comments</comments>
		<pubDate>Fri, 13 Aug 2010 17:41:12 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://www.nanoant.com/?p=573</guid>
		<description><![CDATA[I am proud to announce my company was hired to create Mac version of LiveChat operator software. The application just entered alpha-phase and today closed tests were started. I hope too that the new refreshing LiveChat icon (on the right) designed by me will be the cherry on the project&#8217;s pie. LiveChat provides innovative web [...]]]></description>
			<content:encoded><![CDATA[<p><a class="appstore" href="http://blog.livechatinc.com/2010/07/livechat-for-mac-sneak-peak-1/"><img title="LiveChat Icon" src="http://www.nanoant.com/wp/wp-content/uploads/2010/08/LiveChat-Icon.png" alt="LiveChat Icon" width="128" height="128" /></a>I am proud to announce my company was hired to create <a href="http://www.livechatinc.com/en/overview/live-chat-for-mac-os-x/">Mac version of LiveChat</a> operator software. The application just entered alpha-phase and today closed tests were started. I hope too that the new refreshing <em>LiveChat</em> icon (on the right) designed by me will be the cherry on the project&#8217;s pie.</p>
<p><a href="http://www.livechatinc.com/">LiveChat</a> provides innovative web based customer support solutions including live web statistics and live customer chat. The company has great potential and impressive <a href="http://www.livechatinc.com/en/customers/">customer base</a>, so you may be interested to follow their Twitter feed too <a href="http://twitter.com/livechatinc">here</a>.</p>
<p><span id="more-573"></span></p>
<p>Checkout new L&amp;F from just released alpha and tell me what do you think:</p>
<p style="text-align: center;"><img class="size-full wp-image-582 aligncenter" title="LiveChat Mac Client List" src="http://www.nanoant.com/wp/wp-content/uploads/2010/08/LiveChat-Mac-Client-List.jpg" alt="" width="623" height="399" /></p>
<p>Now I am heading seaside to get some rest, because upcoming September will be busy for sure.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nanoant.com/apple/nanoant-creates-livechat-for-mac/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Browse gossips and latest paparazzi shots on your iPhone</title>
		<link>http://www.nanoant.com/apple/browse-gossips-and-latest-paparazzi-shots-on-your-iphone</link>
		<comments>http://www.nanoant.com/apple/browse-gossips-and-latest-paparazzi-shots-on-your-iphone#comments</comments>
		<pubDate>Tue, 20 Jul 2010 18:07:45 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.nanoant.com/?p=589</guid>
		<description><![CDATA[I should say it first &#8211; mostly Polish gossips, in Polish language. But anyway Kozaczek.pl is another nanoANT&#8217;s piece of craft (mind the spelling). After one week of its premier it topped 2nd in Polish AppStore. We had greater expectations, but some iPhone users here in Poland are really great bigots. I have seen many [...]]]></description>
			<content:encoded><![CDATA[<div class="appstore">
<a href="http://itunes.apple.com/pl/app/kozaczek-pl/id381493919?mt=8"><img title="Kozaczek" src="http://www.nanoant.com/wp/wp-content/uploads/2010/08/Kozaczek.png" alt="" width="114" height="114" /></a></div>
<p>I should say it first &#8211; mostly Polish gossips, in Polish language. But anyway Kozaczek.pl is another nanoANT&#8217;s piece of craft (mind the spelling). After one week of its premier it topped 2nd in Polish AppStore. We had greater expectations, but some iPhone users here in Poland are really great bigots. I have seen many comments accusing some <em>iPhone</em> news editors that they have put a little news about this app, because this app ill befits there. Come on!</p>
<p>Anyway doing this app was a great fun and I believe using it is a great fun too, especially as an alternative to those grave TV news everyday. Checkout official release news <a href="http://www.kozaczek.pl/plotka.php?id=24423">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nanoant.com/apple/browse-gossips-and-latest-paparazzi-shots-on-your-iphone/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DrawIt &#8211; power of Photoshop in non-destructive form</title>
		<link>http://www.nanoant.com/apple/drawit-power-of-photoshop-in-non-destructive-form</link>
		<comments>http://www.nanoant.com/apple/drawit-power-of-photoshop-in-non-destructive-form#comments</comments>
		<pubDate>Thu, 15 Jul 2010 12:16:57 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[DrawIt]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[Photoshop]]></category>
		<category><![CDATA[Vector]]></category>

		<guid isPermaLink="false">http://www.nanoant.com/?p=547</guid>
		<description><![CDATA[I should have written something about DrawIt long time ago, as this small but powerful non-destructive vector based bitmap design tool really deserves the attention. DrawIt was created and is maintained by its author Pieter Omvlee. While doing initial design of this application Pieter asked for help French designer Laurent Baumann (working now for Apple). [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nanoant.com/wp/wp-content/uploads/2010/07/Domek.png"><img class="alignright size-full wp-image-550" title="Domek" src="http://www.nanoant.com/wp/wp-content/uploads/2010/07/Domek.png" alt="" width="234" height="218" /></a>I should have written something about <a href="http://www.bohemiancoding.com/drawit">DrawIt</a> long time ago, as this small but powerful non-destructive vector based bitmap design tool really deserves the attention.</p>
<p><em>DrawIt</em> was created and is maintained by its author <a href="http://pieteromvlee.net/me/">Pieter Omvlee</a>. While doing initial design of this application Pieter asked for help French designer <a href="http://lbaumann.com/">Laurent Baumann</a> (working now for <em>Apple</em>). Pieter&#8217;s skills and Laurent&#8217;s talent joint together created something extraordinary, the great UI of <em>DrawIt</em> made from scratch to give you an ability to quickly create web/bitmap designs with vector tools and stack of effects. I will not get into details here, as you can find few good articles about <em>DrawIt</em> over the Internet, but I will rather describe little experiment of mine I have made today and try to answer the question if <em>DrawIt</em> can be good <em>Photoshop</em> replacement for icon and web design.</p>
<p>Since lately I was forced to use <em>Photoshop</em>, I decided to give <em>DrawIt</em> a try and recreate one of outstanding <em>Photoshop</em> tutorial icons using <em>DrawIt</em>. My choice went for <a href="http://psd.tutsplus.com/tutorials/icon-design/how-to-create-a-basic-house-icon-in-photoshop/">Basic House Icon</a> from PSDTuts+ site. You can see the result of my work above and you can download the <em>DrawIt</em> source file <a href="http://www.nanoant.com/download/drawit/Domek.drawit.zip">here</a>.</p>
<p><span id="more-547"></span>First of all <em>DrawIt</em> is non-destructive vector based program. Which means you can always revise any step and decision you have made during design process. The idea is based on shapes and effects applied onto them, something you could find in <em>Macromedia Fireworks, Freehand</em> (RiP) or <em>Adobe Photoshop</em>&#8216;s layer&#8217;s effects.</p>
<div id="attachment_552" class="wp-caption alignright" style="width: 185px"><img class="size-full wp-image-552" title="Photoshop" src="http://www.nanoant.com/wp/wp-content/uploads/2010/07/Photoshop.png" alt="" width="175" height="93" /><p class="wp-caption-text">Photoshop Layer With Effects</p></div>
<p>As seen on many <em>Photoshop</em> icon design tutorials, the starting point is a path filled with some gradient or simply filled with black color.  Then most of the folks apply effects created out of the path&#8217;s filling. The effects panel used all over again unfortunately is buried in Layers panel and requires extra interaction to pop it up.</p>
<p>In my opinion this really makes me wonder what made <em>Photoshop</em> to be considered better than <em>Macromedia Fireworks</em> or <em>Illustrator</em> for icon design when you are working constantly applying effect, closing and opening Effects window which is simply uncomfortable.</p>
<div id="attachment_554" class="wp-caption alignright" style="width: 158px"><img class="size-full wp-image-554" title="DrawIt" src="http://www.nanoant.com/wp/wp-content/uploads/2010/07/DrawIt.png" alt="" width="148" height="207" /><p class="wp-caption-text">DrawIt Effect Stack</p></div>
<p>Here in <em>DrawIt</em> it is much easier to set effects for particular shape. First of all you are working only shapes, so you can always touch and redefine the shape&#8217;s shape using vector tools, while <em>Photoshop</em> it takes a bit more to redefine layer&#8217;s path, also when you did some manual touch to the layer then redefining its path will kill your modifications.</p>
<p>Also <em>DrawIt</em> effects may be applied in random user&#8217;s defined order. You can also double same effect, disable and reenable them on fly.</p>
<h2>Photoshop&#8217;s touch to the image</h2>
<p>There&#8217;s one thing that you can do in <em>Photoshop</em> but you can&#8217;t in vector based programs. It is some human touch to the color or shade using tools like burn, dodge. Such a &#8220;touch&#8221; can sometimes drastically improve  overall effect. Unfortunately this is impossible simply using <em>DrawIt</em>, as everything is an object here, so dodging particular area of an object is simply impossible.</p>
<p>Nevertheless there is always alternative ways to achieve same effect as you would get using hand drawing <em>Photoshop</em> tools in <em>DrawIt</em>. You just need &#8220;think vector&#8221;. Sometimes experimenting with various settings can result with amazing overall look of an object.</p>
<h2>DrawIt&#8217;s perfection killed by some flaws</h2>
<p>Unfortunately some minor but longstanding bugs are <strong>flies in the DrawIt&#8217;s ointment</strong>. <em>Undo/redo</em> is the basic thing you expect to work well in any program. It does work well in Photoshop, TextMate, iWork, but NOT in <em>DrawIt</em>, that tends to forget some actions in its undo chain, which makes unpleasant surprise when playing with effects.</p>
<p>Another thing that makes you suffer it a way you change colors of gradients and other various objects, sometimes you need to click few times to make DrawIt change the color of selected property. Again, color panel tends to forget what it was attached to, especially when you change switch objects Color panel is still on screen but attached to nothing.</p>
<p>Resizing objects can be very painful too. First, changing objects height makes it change its vertical position, this isn&#8217;t right! Second, trying to resize the document with all objects usually leads to misplacement of those objects.</p>
<p>Finally vector (shape) editing mode deserves more polish, as sometimes you may get crazy if you want to delete several points (no way to drag/select few points), or if you move the point out of the canvas you cannot control it anymore its handle disappears (clipped by canvas rectangle), while you expect shape&#8217;s vector handles should be visible outside of the canvas too.</p>
<h2>Is it worth a price?</h2>
<p><em>DrawIt</em> is absolutely worth its price and I would glad pay for it again if those few annoying bugs were removed. The author is a very kind nice young fellow willing to listen for the new ideas for his project. One of such ideas is slicing functionality that is probably a result IM chat I did with the author while ago.</p>
<p>However peeking recently into author&#8217;s blog it seems he is more focused on his other applications &#8211; too bad, but that&#8217;s life &#8211; you are working on something that gives you best revenue, which may be not <em>DrawIt</em> in this case.</p>
<p>What about <em>Photoshop</em>? In my opinion it is definitely NOT worth a price if you want just an icon design software. I really regret all competing software producers such as <em>Corel</em>, <em>ACD</em>, <em>Xara</em> dropped support for <em>Mac OS X,</em> leaving us in hands of <em>Adobe</em>. Thank God there is <em>DrawIt</em> (and maybe <em>Vectordesigner</em> ;P).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nanoant.com/apple/drawit-power-of-photoshop-in-non-destructive-form/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Wanna be 3.x compatible? Not so simple!</title>
		<link>http://www.nanoant.com/apple/wanna-be-3-x-compatible-not-so-simple</link>
		<comments>http://www.nanoant.com/apple/wanna-be-3-x-compatible-not-so-simple#comments</comments>
		<pubDate>Thu, 08 Jul 2010 15:45:46 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.nanoant.com/?p=527</guid>
		<description><![CDATA[So we got the new shiny iOS 4 with the new not-so-shiny SDK 4. Most desirable aspect of using SDK 4 and iOS 4 functions is to be backward compatible with iPhone OS 3.x. This is where you should set your iPhone OS Deployment Target to iPhone OS 3.0 or anything else you want to [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-541" title="iOS4" src="http://www.nanoant.com/wp/wp-content/uploads/2010/07/iOS4.gif" alt="" hspace="20" width="100" height="74" />So we got the new shiny <em>iOS 4</em> with the new not-so-shiny <em>SDK 4</em>. Most desirable aspect of using SDK 4 and iOS 4 functions is to be backward compatible with <em>iPhone OS 3.x</em>. This is where you should set your <strong>iPhone OS Deployment Target</strong> to <strong>iPhone OS 3.0</strong> or anything else you want to be compatible with.</p>
<p style="text-align: center;"><img class="size-full wp-image-528  aligncenter" title="Xcode" src="http://www.nanoant.com/wp/wp-content/uploads/2010/07/Xcode.png" alt="" width="423" height="29" /></p>
<p>This is the official method, and since SDK 4 does NOT come with 3.x headers, the only method to make your app run on 3.x. But it is not so simple, because now in your <em>Xcode</em> you are using <em>iOS 4</em> API. So how do you know you are not using classes or methods that do not exist in 3.x and putting them into your code will crash your app on 3.x device? You don&#8217;t!</p>
<p><span id="more-527"></span>Unfortunately <em>Xcode</em> will warn you about deprecated API, but will NOT warn you about API that does not exist on your deployment target. <strong>I buy you a beer if you can find such warning option in Xcode project configuration.</strong></p>
<p><strong></strong>This would be acceptable if you could test your application on iPhone 3.x OS Simulator, but there is no any in SDK 4 (neither as an option), hence you can&#8217;t absolutely tell your app won&#8217;t gonna blow on <em>iPhone OS 3.x</em> if you upgraded your TESTING devices to <em>iOS 4</em>.</p>
<p>I have spent a while trying to figure our what was Apple&#8217;s engineers official statement about that on <em>devforums</em>. And they say if you want to test 3.x compatibility you need get a device with <em>iPhone OS 3.x</em>. Huh? So I shall buy an new iPhone expecting it won&#8217;t have iOS 4 on board, because there is no (legal) way to downgrade existing device to 3.x.</p>
<p>Trying to find out a more reasonable way I have ended up with installing an OLD SDK 3.2 on /<tt>Developer-3.2</tt>. Finally tested my application&#8230; but fiddling with SDK 4 was not over. (NOTE: Obviously this method isn&#8217;t really free as you gonna lost 4GB for old SDK installation and 2.5GB for download, but it far less expensive than getting a new old 3.x device.)</p>
<h2>Still there are few gotchas with this method</h2>
<p>And here is one of them. If you happen to use iOS4 API in your code, Apple says that your shall check functions (and class) pointers against <tt>nil</tt>.</p>
<p>One of the new classes introduced by iOS4 API is <strong>UITapGestureRecognizer</strong>. I happened to know that because 3.x SDK complained about unknown <strong>UITapGestureRecognizer</strong> class. So I tried in my code:</p>
<pre class="textmate-source"><strong>UITapGestureRecognizer</strong> *singleTap = [[<strong>UITapGestureRecognizerClass</strong> alloc]
    initWithTarget:self action:<strong>@selector</strong>(handleSingleTap:)];
<strong>if</strong>( singleTap != <strong>nil</strong> ) {
    <em>// do something, we shall be there only on iOS4</em></pre>
<p>Should be enough to be compatible with 3.x device compiling on SDK 4, since <strong>UITapGestureRecognizer</strong> is introduced by iOS4 API I expected that on 3.x it will be <tt>nil</tt> so <tt>singleTap</tt> will be <tt>nil</tt> too! (BTW. It won&#8217;t compile with SDK 3.x I have just installed ;P)</p>
<p>I have sent my app to beta tester with 3.x device, that replied the app is <span style="text-decoration: underline;">still crashing</span>. So my reasoning about <tt>nil</tt> was NOT true. Okay, fine, let&#8217;s try with:</p>
<pre class="textmate-source"><strong>Class</strong> TapGestureRecognizerClass = NSClassFromString(@"<em>UITapGestureRecognizer</em>");
if( TapGestureRecognizerClass != <strong>nil</strong> ) {
    // do something, we shall be there only on iOS4</pre>
<p>Again crashes on 3.x device.</p>
<p>I have lost one day on communication with beta tester and scratching my head. You know why? Because <strong>UITapGestureRecognizer </strong>actually do EXIST in <em>iPhone OS 3.x</em> but it is NOT in the public API. Moreover it misses some methods that do exist in iOS 4 API, so finally I ended up with something like this:</p>
<pre class="textmate-source"><strong>Class</strong> TapGestureRecognizerClass = NSClassFromString(@"<em>UITapGestureRecognizer</em>");
<strong>if</strong>( TapGestureRecognizerClass != <strong>nil</strong> ) {
    UITapGestureRecognizer *singleTap = [[TapGestureRecognizerClass alloc] initWithTarget:self action:<strong>@selector</strong>(handleSingleTap:)];
    <strong>if</strong>( singleTap != <strong>nil </strong>) {
        <strong>if</strong>( [singleTap respondsToSelector:<strong>@selector</strong>(setNumberOfTapsRequired:)] ) {
            [singleTap setNumberOfTapsRequired:1];
        }
        <em>// .. and checking other selectors</em></pre>
<p>And this was my WORKING method to be compatible with 3.x and using some of <em>iOS 4 API</em>. Crazy enough?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nanoant.com/apple/wanna-be-3-x-compatible-not-so-simple/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>iPad is a pretty cool docs browser</title>
		<link>http://www.nanoant.com/apple/ipad-is-a-pretty-cool-docs-browser</link>
		<comments>http://www.nanoant.com/apple/ipad-is-a-pretty-cool-docs-browser#comments</comments>
		<pubDate>Tue, 22 Jun 2010 10:57:41 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Apple]]></category>

		<guid isPermaLink="false">http://www.nanoant.com/?p=503</guid>
		<description><![CDATA[If you have one, check out http://developer.apple.com/iphone/library/ on it. Do you like my iPad stand? It is a table easel, paid 25zł (about $10) and it is far more flexible and sexy than all those overpriced dedicated stands. By the way, iPad screen seems to be more blueish than MacBook&#8217;s. Both are led backlit, so [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-515  aligncenter" title="iPad-docs" src="http://www.nanoant.com/wp/wp-content/uploads/2010/06/iPad-docs.jpg" alt="" width="500" height="307" /></p>
<p>If you have one, check out <a href="http://developer.apple.com/iphone/library/">http://developer.apple.com/iphone/library/</a> on it.</p>
<p>Do you like my <em>iPad</em> stand? It is a table easel, paid 25zł (about $10) and it is far more flexible and sexy than all those overpriced dedicated stands. By the way, <em>iPad</em> screen seems to be more blueish than <em>MacBook&#8217;s</em>. Both are led backlit, so I wonder why?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nanoant.com/apple/ipad-is-a-pretty-cool-docs-browser/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Wezwij Taxi no.1 free app in PL AppStore after 1 day</title>
		<link>http://www.nanoant.com/apple/wezwij-taxi-no-1-free-app-in-pl-appstore-after-1-day</link>
		<comments>http://www.nanoant.com/apple/wezwij-taxi-no-1-free-app-in-pl-appstore-after-1-day#comments</comments>
		<pubDate>Tue, 01 Jun 2010 12:34:37 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[AppStore]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.nanoant.com/?p=487</guid>
		<description><![CDATA[Recently released Wezwij Taxi is surprisingly no.1 free application in Polish AppStore since few days, and became no.1 one day after release. I have just learned that AppStore is amazing phenomenon. It is quite impossible to predict impact of an application before it gets released. Some &#8220;silly&#8221; apps stay on top for weeks, while some [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.wezwijtaxi.pl/"><img style="margin-top: -20px;"  src="http://www.nanoant.com/wp/wp-content/uploads/2010/06/Taxi-150x150.jpg" alt="" title="Wezwij Taxi" width="150" height="150" class="alignright size-thumbnail wp-image-488" /></a>Recently released <a href="http://www.wezwijtaxi.pl/">Wezwij Taxi</a> is surprisingly no.1 free application in <em>Polish AppStore</em> since few days, and became no.1 one day after release.</p>
<p>I have just learned that <em>AppStore</em> is amazing phenomenon. It is quite impossible to predict impact of an application before it gets released. Some <em>&#8220;silly&#8221;</em> apps stay on top for weeks, while some real gems are quickly forgotten. So it is worth to test even most crazy wicked ideas against iPhone users putting them into life as <em>AppStore</em> app.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nanoant.com/apple/wezwij-taxi-no-1-free-app-in-pl-appstore-after-1-day/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One app heading to AppStore, one already there!</title>
		<link>http://www.nanoant.com/apple/two-apps-heading-to-appstore</link>
		<comments>http://www.nanoant.com/apple/two-apps-heading-to-appstore#comments</comments>
		<pubDate>Mon, 17 May 2010 12:00:51 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[AppStore]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[taxi]]></category>

		<guid isPermaLink="false">http://www.nanoant.com/?p=435</guid>
		<description><![CDATA[It is high time to release own application iPhone after spending a while doing apps for companies. So I decided to make something useful for myself what others can appreciate too. Here are my very own apps: Strefa a Wirtualna Polska Strefa MP3 streaming audio client. Strefa MP3 is a portal containing over 100&#8217;000 songs [...]]]></description>
			<content:encoded><![CDATA[<div class="appstore"><a href="http://itunes.apple.com/pl/artist/nanoant/id370141310"><img src="http://www.nanoant.com/wp/wp-content/uploads/2010/05/app_store-e1274217190533.png" alt="" title="Available at AppStore" width="150" height="49" /></a><br />
<a href="http://www.wezwijtaxi.pl"><img src="http://www.nanoant.com/wp/wp-content/uploads/2010/05/Icon.png" alt="" title="Wezwij Taxi" width="57" height="57" class="size-full wp-image-449" /></a><a href="/projects/strefa"><img src="http://www.nanoant.com/wp/wp-content/uploads/2010/05/iPhone-Icon.png" alt="" title="Strefa" width="57" height="57" class="size-full wp-image-447" /></a></div>
<p>It is high time to release own application <em>iPhone</em> after spending a while doing apps for companies. So I decided to make something useful for myself what others can appreciate too.</p>
<p>Here are my very own apps:</p>
<ul>
<li class="strefa"><a href="/projects/strefa">Strefa</a> a <a href="http://mp3.wp.pl/">Wirtualna Polska Strefa MP3</a> streaming audio client. Strefa MP3 is a portal containing over 100&#8217;000 songs of amateur and professional polish artists, every day brings tens of new songs. IMHO that is much better than commercial radio stations serving all those boring pieces we already heard before thousand times.</li>
<li class="wezwijtaxi"><a href="http://www.wezwijtaxi.pl/">Wezwij Taxi</a> a polish taxi catalog and taximeter in one app. Now this program has one purpose: keep updated database of taxis for major cities of Poland. But in the future, I think this app can turn into some kind of one button taxi call, using your GPS position without a need to call or name your position to the operator. Useful for those traveling to unfamiliar cities.</li>
</ul>
<p><strong>Update:</strong> <em>Strefa</em> is already available at <em>AppStore</em>, <em>Wezwij Taxi</em> waits for fixes and resubmit.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nanoant.com/apple/two-apps-heading-to-appstore/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compiling kernel IEGD 10.x module for any Linux distribution</title>
		<link>http://www.nanoant.com/linux/compiling-kernel-iegd-10x-module-for-any-linux-distribution</link>
		<comments>http://www.nanoant.com/linux/compiling-kernel-iegd-10x-module-for-any-linux-distribution#comments</comments>
		<pubDate>Fri, 19 Feb 2010 13:23:55 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[IEGD]]></category>
		<category><![CDATA[Intel]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[module]]></category>

		<guid isPermaLink="false">http://www.nanoant.com/?p=354</guid>
		<description><![CDATA[Intel has put great effort to put complete open-source drivers into recent kernels for its devices. Only device that is clearly missing there is GMA500 (aka Poulsbo, aka US15 chipset, aka Atom Z5xx family). This is understood as it does relay on Imagination Technologies PowerVR core licensed out by Intel to produce GMA500, so most [...]]]></description>
			<content:encoded><![CDATA[<p><em><a href="http://www.nanoant.com/wp/wp-content/uploads/2010/02/atom1.gif"><img class="alignright size-full wp-image-377" title="Intel Atom" src="http://www.nanoant.com/wp/wp-content/uploads/2010/02/atom1.gif" alt="" width="81" height="100" /></a>Intel</em> has put great effort to put complete open-source drivers into recent kernels for its devices. Only device that is clearly missing there is <em>GMA500</em> (aka <em>Poulsbo,</em> aka <em>US15</em> chipset, aka <em>Atom Z5xx</em> family). This is understood as it does relay on I<em>magination Technologies PowerVR</em> core licensed out by <em>Intel</em> to produce <em>GMA500</em>, so most of the driver parts cannot go open-source as it would imply of violation of some agreement between <em>ImgTec</em> and <em>Intel</em>.<br />
<span id="more-354"></span></p>
<p>Fortunately Intel provides binary driver set called <a href="http://edc.intel.com/Software/Downloads/IEGD/">Intel® Embedded Graphics Driver</a> (<em>IEGD</em>) supporting all embedded video chipsets, containing binary form of video driver libraries for latest <em>Xorg</em>, <em>OpenGL</em> and <em>VA</em>.</p>
<p>While most of the work you need to do is to have <tt>IEGD_10_3_Linux.tgz</tt> file (in case of <em>IEGD 10.3</em>) extracted onto the target box and to copy various <tt>.so</tt> files in proper places (follow <em>IEGD</em> documentation). Yet there is one more complicated thing extra &#8211; <em>IEGD Kernel Module</em> (<em>IKM</em>) <tt>iegd_mod.ko</tt> that has to be compiled out of the source shipped with <em>IEGD</em>.</p>
<h2>Linux Kernel module</h2>
<p><em>IEGD</em> documentation clearly states that only few distributions are supported by this driver, and those are i.e. <em>Fedora 8</em> &amp; <em>10</em>, some older <em>Ubuntu 8.x</em> and finally <em>Moblin</em>. But what about others, such as <em>Debian</em>, newer <em>Ubuntu</em>. You think you are unlucky running other distro? You shall understand word &#8220;supported&#8221; here as &#8220;tested&#8221;.</p>
<p>Reading the documentation, in all cases your are supposed to enter <tt>IKM</tt> folder of extracted drivers and launch <tt>install.sh</tt> script. This script shall compile and install without any hassle IKM on &#8220;supported&#8221; distributions. Surprisingly trying that on your distribution even it is not supported may work too! With one important exception it produces bogus driver that will crash your kernel.</p>
<h2>Finding the proper way for your distribution</h2>
<p>This recipe will save some few hours upto few days of struggling with fancy errors trying to compile and run the IKM module on your system <img src='http://www.nanoant.com/wp/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Investigating the driver and <tt>install.sh</tt> first thing to notice is that it checks you <em>Kernel</em> version, it also takes (false) assumption that your are running one of the &#8220;supported&#8221; distros, so i.e <tt>2.6.27</tt> may mean Fedora version of the <tt>2.6.27</tt> <em>Kernel</em> not any <tt>2.6.27</tt> kernel.</p>
<p><em>Linux</em> distributions have this fancy characteristic that they usually come with heavily patched kernel, so when you take <tt>2.6.xx</tt> driver module from one distro and try to run it on the same version kernel on the other distro it will likely crash your kernel. Why? Incompatible ABI.</p>
<p>What <em>Intel</em> (<em>Tungsten?</em>) did in <em>IKM</em> is prepared <tt>IKM/val</tt> subfolder with headers <strong>extracted</strong> from several kernel sources of &#8220;supported&#8221; distributions. And what <tt>install.sh</tt> does, it tries to guess which one of <tt>DRM</tt> and <tt>AGP</tt> kernel module headers placed in that subfolder are OK for your <em>Kernel</em>.</p>
<p>In case you are running on the &#8220;unsupported&#8221; distribution the answer in 95% cases is <strong>NONE</strong>! Even you will be able to compile the <tt>iegd_mod.ko</tt> using <tt>Makefile</tt> produced by <tt>install.sh</tt> the module will crash you kernel as soon you will try to use it. Since your kernel has incompatible ABI (different structures) with the ABI provided inside <tt>IKM/val</tt> subfolder.</p>
<h2>Preparing for compilation of <em>IKM</em> for your own kernel</h2>
<p>If you are running &#8220;unsupported&#8221; distribution you should avoid then using headers in <tt>IKM/val</tt> subfolder. The right way is to take <tt>AGP</tt> and <tt>DRM</tt> headers out of your running kernel sources (you don&#8217;t have to compile the whole kernel of course).</p>
<p>So go to <tt>IEGD_10_3_Linux</tt> folder and launch:</p>
<pre>sudo apt-get install linux-headers-x.y.zz
apt-get source linux-image-x.y.zz</pre>
<p>Where <tt>x.y.zz</tt> is your running kernel version. (Use your own distro command to grab kernel source if you don&#8217;t run on <em>Debian</em> or <em>Ubuntu</em>)</p>
<p>This will install kernel headers and scripts to build kernel modules and also produce <tt>linux-x.y.zz</tt> folder containing source code of your running <em>Kernel</em>. The whole trick if to place (replace) <tt>Makefile</tt> in <tt>IKM</tt> folder as below:</p>
<pre class="textmate-source"><span class="source source_makefile"><span class="variable variable_other variable_other_makefile">KERNELVER ?= $(shell uname -r)</span>
<span class="variable variable_other variable_other_makefile">KERNELDIR ?= /lib/modules/$(KERNELVER)/build</span>
<span class="variable variable_other variable_other_makefile">INSTALLDIR ?= /lib/modules/$(KERNELVER)/kernel/drivers/char/agp</span>
<span class="variable variable_other variable_other_makefile">PWD ?= $(realpath .)</span>

EXTRA_CFLAGS += -I$(PWD)/include
EXTRA_CFLAGS += -I$(PWD)/../linux-$(KERNELVER)/drivers/char/agp
EXTRA_CFLAGS += -I/lib/modules/$(KERNELVER)/build/include/drm

<span class="meta meta_function meta_function_makefile"><span class="entity entity_name entity_name_function entity_name_function_makefile">all:</span> clean modules</span>

<span class="meta meta_function meta_function_makefile"><span class="entity entity_name entity_name_function entity_name_function_makefile">modules:</span>
</span>	@echo $(PWD)
	@$(MAKE) -C $(KERNELDIR) M=$(PWD) modules

<span class="meta meta_function meta_function_makefile"><span class="entity entity_name entity_name_function entity_name_function_makefile">install:</span>
</span>	install -o root -g root -m 755 -d $(INSTALLDIR)
	install -o root -g root -m 744 iegd_mod.ko $(INSTALLDIR)
	/sbin/depmod -a

<span class="meta meta_function meta_function_makefile"><span class="entity entity_name entity_name_function entity_name_function_makefile">uninstall:</span>
</span>	rm -rf $(INSTALLDIR)/iegd_mod.ko
	/sbin/depmod -a

<span class="meta meta_function meta_function_makefile"><span class="entity entity_name entity_name_function entity_name_function_makefile">clean:</span>
</span>	@rm -f *.o iegd*.ko iegd*.mod.c iegd*.o agp/*.o drm/*.o Module.symvers
	@rm -fr .intel* .tmp* .*.cmd agp/.*.cmd drm/.*.cmd

obj-m := iegd_mod.o
iegd_mod-objs := agp/pci.o agp/global.o agp/drv_alm.o agp/drv_nap.o agp/drv_plb.o agp/drv_cmn.o agp/drv_gn4.o drm/iegd_drv.o drm/iegd_interface.o drm/iegd_interface_265.o drm/iegd_interface_2611.o drm/iegd_interface_2615.o drm/iegd_interface_2624.o drm/psb_irq.o</span></pre>
<p>You don&#8217;t need to launch <tt>install.sh</tt> at all. Just paste the file as above.</p>
<p>As you see now, this <tt>Makefile</tt> references to <tt>../linux-$(KERNELVER)</tt> for your running <em>Kernel</em> source <tt>AGP</tt> &amp; <tt>DRM</tt> headers. Yet however you may still need to do few tweaks in your <tt>Makefile</tt>, see notes below:</p>
<p><strong>Note (1)</strong> In case you are running older kernel, <tt>/lib/modules/$(KERNELVER)/build/include/drm </tt>may not exist, then <tt>$(PWD)/../linux-$(KERNELVER)/drivers/char/drm </tt>should be right path to put in the <tt>Makefile</tt> instead.</p>
<p><strong>Note (2)</strong> The <em>Kernel</em> source code folder you downloaded (i.e. via <tt>apt-get source</tt>) may not actually match exactly <tt>linux-$(KERNELVER)</tt>, so you may change that <tt>EXTRA_CFLAGS</tt> setting manually:</p>
<ul>
<li>In case of <em>Ubuntu</em> `<tt>uname -r</tt>` is <tt>2.6.31-19-generic</tt> while the extracted source folder name has no <tt>-generic</tt> suffix and it is just <tt>linux-2.6.31-19</tt>.</li>
<li>In case of <em>Debian</em> `<tt>uname -r</tt>` is <tt>2.6.26-21</tt> while the extracted source folder name is <tt>linux-2.6-2.6.26-21</tt>. Weird huh?</li>
</ul>
<h3>Final fixes before compilation</h3>
<p>There is a file still missing if you try now to `<tt>make</tt>`. It is file that exists in <tt>IKM/val/agp</tt> but does not exist in your <tt>$(PWD)/../linux-$(KERNELVER)/drivers/char/agp</tt>. It is called <tt>interface_abs.h</tt>.</p>
<p>Wonder why the heck it is NOT in <tt>IKM/include</tt>!? This is a little lack of consequence from <em>Intel</em> here.</p>
<p>Anyway just copy <tt>interface_abs.h</tt> into <tt>IKM/include</tt> out of <tt>IKM/val/agp/agpm0vmob2</tt> if you are running on &gt;= 2.6.30 <em>Kernel</em> or from <tt>IKM/val/agp/agpm0v103</tt> otherwise. The only difference between <tt>interface_abs.h</tt> from <tt>agpm0vmob2</tt> and <tt>agpm0v103</tt> is one macro definition.</p>
<p>Finally we need two little extra fixes.</p>
<p><strong>(1)</strong> Trying to compile on <em>Debian Lenny</em> we will get many nasty errors from kernel headers for <tt>IKM/drm/iegd_interface.c</tt>. Moving <tt>igd_abs.h</tt> inclusion in this source file little down fixes the issue. Edit <tt>IKM/drm/iegd_interface.c</tt> as below:</p>
<pre> #include "iegd.h"
<strong>-#include "igd_abs.h"</strong>
 #include "drmP.h"
 #include "drm.h"

<strong>+#include "igd_abs.h"</strong>
 #include "iegd_drm.h"
 #include "iegd_drv.h"
 #include "psb_intregs.h"</pre>
<p><strong>(2)</strong> <tt>IKM/drm/iegd_drv.c</tt> tries to include <tt>linux/config.h</tt> at the very begining of the file. This is not actually necessary, and anyway does not exist, so you may comment that out:</p>
<pre><strong>-#include &lt;linux/config.h&gt;
+/* #include &lt;linux/config.h&gt; */</strong></pre>
<h3>Compiling at last</h3>
<p>Now you are ready to so `<tt>make</tt>` and `<tt>sudo make install</tt>`. This time  <tt>iegd_mod.ko</tt> should be ABI compatible with your kernel.</p>
<p>I have tested this method on <em>Debian 5.0 Lenny</em> and <em>Ubuntu 9.10 Karmic Koala</em>.</p>
<p>To ensure everything works fine after driver installation try:</p>
<pre>sudo modprobe iegd_mod</pre>
<p>And try to go into <tt>IKM/agp</tt> and compile and run <tt>agp_test.c</tt>:</p>
<pre>gcc -o agp_test agp_test.c
sudo ./agp_test</pre>
<p>Next try the same with <tt>IKM/drm</tt> compiling and running <tt>drm_test.c</tt>.</p>
<p>If those two test won&#8217;t fail and won&#8217;t blow your kernel it means you have fully working <em>IEGD</em> module on your own <em>Linux</em> distro.</p>
<h3>Notes for users of old psb-modules or psb-kernel-source Ubuntu package</h3>
<p>Older <em>psb-modules</em> and <em>psb-kernel-source</em> <em>Ubuntu</em> packages install their own incompatible <tt>drm.ko</tt> module at <tt>/lib/modules/`uname -r`/updates/char/drm</tt>.</p>
<p>Check <tt>find /lib/modules/`uname -r` -type f -name 'drm*'</tt> you should have only one: <tt>/lib/modules/`uname -r`/kernel/drivers/gpu/drm/drm.ko</tt></p>
<p>In case if you find other <tt>drm.ko</tt>, probably in <tt>updates/char/drm</tt> delete it. That one came from <em>psb-kernel-source</em> and is causing you a trouble. You may ensure you got only valid <tt>drm.ko</tt> reinstalling your kernel image with:</p>
<p><tt>apt-get install --reinstall linux-image-`uname -r`</tt></p>
<h2>Notes for curious</h2>
<p>The difference of <tt>Makefile</tt> of mine and <tt>Makefile</tt> produced of <tt>install.sh</tt> is the beginning:</p>
<pre class="textmate-source"><span class="source source_makefile"><span class="variable variable_other variable_other_makefile">KERNELVER ?= $(shell uname -r)</span>
<span class="variable variable_other variable_other_makefile">KERNELDIR ?= /lib/modules/$(KERNELVER)/build</span>
<span class="variable variable_other variable_other_makefile">INSTALLDIR ?= /lib/modules/$(KERNELVER)/kernel/drivers/char/agp</span>
<span class="variable variable_other variable_other_makefile">PWD ?= $(realpath .)</span>

EXTRA_CFLAGS += -I$(PWD)/include
EXTRA_CFLAGS += -I$(PWD)/../linux-$(KERNELVER)/drivers/char/agp
EXTRA_CFLAGS += -I/lib/modules/$(KERNELVER)/build/include/drm</span></pre>
<p>If you try to run <tt>install.sh</tt> <tt>EXTRA_CFLAGS</tt> will include two of <tt>IKM/val</tt> folders which contain some <em>Kernel</em> source extracted header definitions that are likely not compatible with your <em>Kernel</em>.</p>
<p>I use also <tt>PWD ?= $(realpath .</tt>) here instead of <tt>PWD ?= $(shell pwd)</tt> because with some <em>Linux</em> headers versions $(shell pwd) resolves to /lib/modules path not the path where IKM sources are.</p>
<h2>Notes for <em>Intel</em></h2>
<p>It would be nice for next <em>IEGD</em> release if <em>IKM</em> source tree would be made for readable and clear:</p>
<ol>
<li><tt>IKM/val</tt> should be renamed to <tt>IKM/kernel-headers</tt> (what the heck &#8220;val&#8221; means here ?!) and this should be noted somewhere in docs that files here are NOT made by <em>Intel</em> but extracted of &#8220;supported&#8221; <em>Linux</em> distributions <em>Kernel</em> sources</li>
<li><tt>interface_abs.h</tt> should moved away from <tt>IKM/val</tt> (<tt>IKM/kernel-headers</tt>) to avoid confusion (with point 1) and placed into <tt>IKM/includes</tt> (and there should be <tt>#ifdef</tt> for this one macro that makes it different for across 2.6.30)</li>
<li><tt>IKM/drm/iegd_interface.c</tt> should be fixed as described above (moving <tt>iegd_abs.h</tt> inclusion little bit down).</li>
<li><tt>IKM/drm/iegd_drv.c</tt> inclusion of <tt>&lt;include/config.h&gt;</tt> is not necessary, may be removed.</li>
<li>Finally <tt>install.sh</tt> should contain case when running on &#8220;unsupported&#8221; distribution.<br />
So it shall make SURE if running on &#8220;supported&#8221; distributions and then and only then use files from <tt>IKM/kernel-headers</tt>, OTHERWISE ask for a path for your own <em>Linux</em> distribution <em>Kernel</em> source&#8217;s to find a path for your own <tt>kernel/drivers/char/agp</tt> and <tt>kernel/drivers/char/drm</tt> (<tt>include/drm</tt>) i.e. by showing:</p>
<pre>Your Linux distribution and Kernel version was untested, however you may try to compile and run driver on your own risk.
Please provide your running kernel sources extracted i.e. on Debian or Ubuntu using apt-get source linux-image-2.6-686:
[path to your kernel]:</pre>
</li>
</ol>
<h3>Fell free to post your comments and problems with method presented here below using comment form!</h3>
]]></content:encoded>
			<wfw:commentRss>http://www.nanoant.com/linux/compiling-kernel-iegd-10x-module-for-any-linux-distribution/feed</wfw:commentRss>
		<slash:comments>52</slash:comments>
		</item>
		<item>
		<title>Is closed-source project like CMSity doomed to the death nowadays?</title>
		<link>http://www.nanoant.com/projects/is-closed-source-project-like-cmsity-doomed-to-the-death-nowadays</link>
		<comments>http://www.nanoant.com/projects/is-closed-source-project-like-cmsity-doomed-to-the-death-nowadays#comments</comments>
		<pubDate>Tue, 28 Apr 2009 14:31:46 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[cmsity]]></category>
		<category><![CDATA[future]]></category>
		<category><![CDATA[open-source]]></category>

		<guid isPermaLink="false">http://www.nanoant.com/?p=317</guid>
		<description><![CDATA[Seems it is very hard to spread the news about CMSity around the world, and acquire some user base of this project. Till now I did few commercial deployments of CMSity, however the cmsity.com page hits look really miserable. I wrote mails to many CMS magazines asking to drop a note about my project. However [...]]]></description>
			<content:encoded><![CDATA[<p class="alignright"><a href="http://www.cmsity.com/"><img class="size-full wp-image-181" title="CMSity Logo" src="http://www.nanoant.com/wp/wp-content/uploads/2009/03/cmsity_ss.png" alt="" width="278" height="89" /></a></p>
<p>Seems it is very hard to spread the news about <a href="http://www.cmsity.com/">CMSity</a> around the world, and acquire some user base of this project. Till now I did few commercial deployments of <em>CMSity</em>, however the <a href="http://www.cmsity.com/users">cmsity.com</a> page hits look really miserable.</p>
<p>I wrote mails to many <em>CMS</em> magazines asking to drop a note about my project. However only two of them replied and posted something on their sites about <em>CMSity</em>. So I still miss some more reviews that can put a breathe into the project. But it seems my mails are ignored by majority of big <em>CMS</em> related sites making very hard to promote new project like <em>CMSity</em> nowadays.</p>
<p>Since I believe this software presents great value and <a href="http://www.cmsity.com/blog/cmsity-vs-wordpress">outperforms other popular solutions</a> I consider releasing it as <strong>open-source</strong>, however probably not <strong>GPL</strong> but some license that will force the code to stay by the author (me), deny all the forks, making all community changes happen to be included in the source code base.</p>
<p>Open-source is a great idea, but I have seen too many projects that were just bloated, forked and spoiled by masses of developers that were just about put something of themselves in the project regardless of quality of the included changes, missing overall sense and directions of the project itself. That is why I decided to keep the code closed initially, while giving the licenses for free, but it seems non-open source project are just kicked out of the focus today, and releasing the source code is a &#8220;must&#8221; to gain the momentum.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nanoant.com/projects/is-closed-source-project-like-cmsity-doomed-to-the-death-nowadays/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Haml + Gettext = automagic translation</title>
		<link>http://www.nanoant.com/programming/haml-gettext-automagic-translation</link>
		<comments>http://www.nanoant.com/programming/haml-gettext-automagic-translation#comments</comments>
		<pubDate>Mon, 13 Apr 2009 21:39:41 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[haml templates ruby performance i18n l10n multilanguage]]></category>

		<guid isPermaLink="false">http://www.nanoant.com/?p=290</guid>
		<description><![CDATA[I was rather sceptic to Haml once I have first time read about it. But after recently playing a while with it I can frankly express that it is simply outstanding template engine for Ruby. What I miss about Haml is some seamless integration with some i18n framework (gem). So I decided to create Haml [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" src="http://www.nanoant.com/wp/wp-content/uploads/2009/04/haml.gif" alt="Haml logo" />I was rather sceptic to <a href="http://haml.hamptoncatlin.com/">Haml</a> once I have first time read about it. But after recently playing a while with it I can frankly express that it is simply outstanding template engine for <a href="http://www.ruby-lang.org/">Ruby</a>. What I miss about <em>Haml</em> is some seamless integration with some i18n framework (gem).</p>
<p>So I decided to create <em>Haml</em> &#8220;mod&#8221; that uses <a href="http://www.yotabanana.com/hiki/ruby-gettext.html">GetText</a> (<a href="http://github.com/grosser/fast_gettext/tree/master">FastGettext</a> alternatively) to automagically translate static texts from <em>Haml</em> templates during precompilation stage. So something that you don&#8217;t see and you don&#8217;t need to worry about.<span id="more-290"></span></p>
<p>Normally you would use <tt>_(text)</tt> calls to translate string in your templates as below:</p>
<pre class="textmate-source"><span class="text text_haml"><span class="meta meta_tag meta_tag_haml"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_haml">%</span><span class="entity entity_name entity_name_tag entity_name_tag_haml">h1</span></span><span class="meta meta_line meta_line_ruby meta_line_ruby_haml">=<span class="source source_ruby source_ruby_embedded source_ruby_embedded_haml"> _<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>Items<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span></span></span>
<span class="meta meta_line meta_line_ruby meta_line_ruby_haml">-<span class="source source_ruby source_ruby_embedded source_ruby_embedded_haml"> items<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>each </span><span class="source source_ruby source_ruby_embedded source_ruby_embedded_html"><span class="keyword keyword_control keyword_control_ruby keyword_control_ruby_start-block">do</span> |item|</span></span>
  <span class="entity entity_name entity_name_tag entity_name_tag_class entity_name_tag_class_haml">.item</span>
    <span class="meta meta_tag meta_tag_haml"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_haml">%</span><span class="entity entity_name entity_name_tag entity_name_tag_haml">h1</span></span><span class="meta meta_line meta_line_ruby meta_line_ruby_haml">=<span class="source source_ruby source_ruby_embedded source_ruby_embedded_haml"> item<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>title</span></span>
    <span class="meta meta_tag meta_tag_haml"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_haml">%</span><span class="entity entity_name entity_name_tag entity_name_tag_haml">a</span></span><span class="meta meta_section meta_section_attributes meta_section_attributes_haml">{<span class="meta meta_syntax meta_syntax_ruby meta_syntax_ruby_start-block"> </span>href<span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span><span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>/edit<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span> }</span><span class="meta meta_line meta_line_ruby meta_line_ruby_haml">=<span class="source source_ruby source_ruby_embedded source_ruby_embedded_haml"> _<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>Edit<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span></span></span>
    <span class="meta meta_tag meta_tag_haml"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_haml">%</span><span class="entity entity_name entity_name_tag entity_name_tag_haml">a</span></span><span class="meta meta_section meta_section_attributes meta_section_attributes_haml">{<span class="meta meta_syntax meta_syntax_ruby meta_syntax_ruby_start-block"> </span>href<span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span><span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>/delete<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span> }</span><span class="meta meta_line meta_line_ruby meta_line_ruby_haml">=<span class="source source_ruby source_ruby_embedded source_ruby_embedded_haml"> _<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>Delete<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span></span></span></span></pre>
<p>You can see this is pretty ugly and unreadable. If you gonna have multi-language site you want to translate all of the static texts there anyway, without doing anything extra. So you would prefer to type:</p>
<pre class="textmate-source"><span class="text text_haml"><span class="meta meta_tag meta_tag_haml"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_haml">%</span><span class="entity entity_name entity_name_tag entity_name_tag_haml">h1</span></span><span class="meta meta_line meta_line_ruby meta_line_ruby_haml">=<span class="source source_ruby source_ruby_embedded source_ruby_embedded_haml"> <span class="variable variable_other variable_other_constant variable_other_constant_ruby">Items</span></span></span>
<span class="meta meta_line meta_line_ruby meta_line_ruby_haml">-<span class="source source_ruby source_ruby_embedded source_ruby_embedded_haml"> items<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>each </span><span class="source source_ruby source_ruby_embedded source_ruby_embedded_html"><span class="keyword keyword_control keyword_control_ruby keyword_control_ruby_start-block">do</span> |item|</span></span>
  <span class="entity entity_name entity_name_tag entity_name_tag_class entity_name_tag_class_haml">.item</span>
    <span class="meta meta_tag meta_tag_haml"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_haml">%</span><span class="entity entity_name entity_name_tag entity_name_tag_haml">h1</span></span><span class="meta meta_line meta_line_ruby meta_line_ruby_haml">=<span class="source source_ruby source_ruby_embedded source_ruby_embedded_haml"> item<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>title</span></span>
    <span class="meta meta_tag meta_tag_haml"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_haml">%</span><span class="entity entity_name entity_name_tag entity_name_tag_haml">a</span></span><span class="meta meta_section meta_section_attributes meta_section_attributes_haml">{<span class="meta meta_syntax meta_syntax_ruby meta_syntax_ruby_start-block"> </span>href<span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span><span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>/edit<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span> }</span> Edit
    <span class="meta meta_tag meta_tag_haml"><span class="punctuation punctuation_definition punctuation_definition_tag punctuation_definition_tag_haml">%</span><span class="entity entity_name entity_name_tag entity_name_tag_haml">a</span></span><span class="meta meta_section meta_section_attributes meta_section_attributes_haml">{<span class="meta meta_syntax meta_syntax_ruby meta_syntax_ruby_start-block"> </span>href<span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span><span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>/delete<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span> }</span> Delete</span></pre>
<p>And have <em>&#8220;Items&#8221;</em>, <em>&#8220;Edit&#8221;</em>, <em>&#8220;Delete&#8221;</em> just translated, right? This is what my mod does. It translates all of those at precompilation stage which also is much better for your application performance, since <em>GetText</em> routines are called only once at precompilation stage. Here it goes.</p>
<h3>haml_gettext.rb</h3>
<pre class="textmate-source"><span class="source source_ruby"><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> Haml gettext module providing gettext translation for all Haml plain text calls
</span><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span>
</span><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> http://pastie.org/445295
</span>
<span class="meta meta_class meta_class_ruby"><span class="keyword keyword_control keyword_control_class keyword_control_class_ruby">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby">Haml::Engine</span></span>
<span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby">  <span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> Inject _ gettext into plain text and tag plain text calls
</span>  <span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">push_plain</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">text</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
    <span class="keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby">super</span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>_<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>text<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">))</span>
  <span class="keyword keyword_control keyword_control_ruby">end</span>
  <span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">parse_tag</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">line</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
    tag_name<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> attributes<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> attributes_hash<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> object_ref<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> nuke_outer_whitespace<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span>
      nuke_inner_whitespace<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> action<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> value <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby">super</span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>line<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
    value <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> _<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>value<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span> <span class="keyword keyword_control keyword_control_ruby">unless</span> action <span class="keyword keyword_operator keyword_operator_logical keyword_operator_logical_ruby">||</span> value<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>empty?
    <span class="punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby">[</span>tag_name<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> attributes<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> attributes_hash<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> object_ref<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> nuke_outer_whitespace<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span>
        nuke_inner_whitespace<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> action<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> value<span class="punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby">]</span>
  <span class="keyword keyword_control keyword_control_ruby">end</span>
<span class="keyword keyword_control keyword_control_ruby">end</span></span></pre>
<p>All you need is to choose <em>GetText</em> or <em>FastGettext</em> and load my mod later on.</p>
<pre class="textmate-source"><span class="source source_ruby"><span class="meta meta_require meta_require_ruby"><span class="keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby">require</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>haml<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span></span>
<span class="meta meta_require meta_require_ruby"><span class="keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby">require</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>fast_gettext<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span></span>
<span class="keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby">include</span> <span class="support support_class support_class_ruby">FastGettext</span><span class="punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby">::</span><span class="variable variable_other variable_other_constant variable_other_constant_ruby">Translation</span>
<span class="meta meta_require meta_require_ruby"><span class="keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby">require</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>haml_gettext<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span></span></span></pre>
<p>You probably want to know the way to your gettext pot/po files out of the tempaltes. I have prepared here Rake tasks for you as well (based on work I found somewhere over Ruby blogs) to parse Haml templates extended to include static texts in the translation.</p>
<h3>Rakefile</h3>
<pre class="textmate-source"><span class="source source_ruby">desc <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>Update pot/po files.<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
task <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>updatepo</span> <span class="keyword keyword_control keyword_control_start-block keyword_control_start-block_ruby">do
</span>  <span class="meta meta_require meta_require_ruby"><span class="keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby">require</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>gettext/tools<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span></span>
  <span class="meta meta_require meta_require_ruby"><span class="keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby">require</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>haml_parser<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span></span>
  <span class="support support_class support_class_ruby">GetText</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>update_pofiles<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>rbigg<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="support support_class support_class_ruby">Dir</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>glob<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>{lib,views}/**/*.{rb,haml}<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_augmented keyword_operator_assignment_augmented_ruby">&lt;&lt;</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>rbigg.rb<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>rbigg 1.0.0<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span><span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> <span class="constant constant_other constant_other_symbol constant_other_symbol_ruby"><span class="punctuation punctuation_definition punctuation_definition_constant punctuation_definition_constant_ruby">:</span>po_root</span> <span class="punctuation punctuation_separator punctuation_separator_key-value">=&gt;</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>locale<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
<span class="keyword keyword_control keyword_control_ruby">end</span></span></pre>
<h3>haml_parser.rb</h3>
<pre class="textmate-source"><span class="source source_ruby"><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> Haml gettext parser module
</span><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span>
</span><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> http://pastie.org/445297
</span><span class="meta meta_require meta_require_ruby"><span class="keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby">require</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>gettext/tools/rgettext<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span></span>
<span class="meta meta_require meta_require_ruby"><span class="keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby">require</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>gettext/parser/ruby<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span></span>
<span class="meta meta_require meta_require_ruby"><span class="keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby">require</span> <span class="string string_quoted string_quoted_single string_quoted_single_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">'</span>haml<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">'</span></span></span>

<span class="meta meta_class meta_class_ruby"><span class="keyword keyword_control keyword_control_class keyword_control_class_ruby">class</span> <span class="entity entity_name entity_name_type entity_name_type_class entity_name_type_class_ruby">Haml::Engine</span></span>
<span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby">  <span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> Overriden function that parses Haml tags
</span><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby">  <span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> Injects gettext call for plain text action.
</span>  <span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">parse_tag</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">line</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
    tag_name<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> attributes<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> attributes_hash<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> object_ref<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> nuke_outer_whitespace<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span>
      nuke_inner_whitespace<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> action<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> value <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="keyword keyword_control keyword_control_pseudo-method keyword_control_pseudo-method_ruby">super</span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>line<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
    <span class="variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_ruby">@</span>precompiled</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_augmented keyword_operator_assignment_augmented_ruby">&lt;&lt;</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>_(<span class="constant constant_character constant_character_escape constant_character_escape_ruby">\"</span><span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>value<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}</span></span><span class="constant constant_character constant_character_escape constant_character_escape_ruby">\"</span>)<span class="constant constant_character constant_character_escape constant_character_escape_ruby">\n</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span> <span class="keyword keyword_control keyword_control_ruby">unless</span> action <span class="keyword keyword_operator keyword_operator_logical keyword_operator_logical_ruby">||</span> value<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>empty?
    <span class="punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby">[</span>tag_name<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> attributes<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> attributes_hash<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> object_ref<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> nuke_outer_whitespace<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span>
        nuke_inner_whitespace<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> action<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> value<span class="punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby">]</span>
  <span class="keyword keyword_control keyword_control_ruby">end</span>
<span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby">  <span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> Overriden function that producted Haml plain text
</span><span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby">  <span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> Injects gettext call for plain text action.
</span>  <span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">push_plain</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">text</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
    <span class="variable variable_other variable_other_readwrite variable_other_readwrite_instance variable_other_readwrite_instance_ruby"><span class="punctuation punctuation_definition punctuation_definition_variable punctuation_definition_variable_ruby">@</span>precompiled</span> <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_augmented keyword_operator_assignment_augmented_ruby">&lt;&lt;</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>_(<span class="constant constant_character constant_character_escape constant_character_escape_ruby">\"</span><span class="source source_ruby source_ruby_embedded source_ruby_embedded_source"><span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">#{</span>text<span class="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_ruby">}</span></span><span class="constant constant_character constant_character_escape constant_character_escape_ruby">\"</span>)<span class="constant constant_character constant_character_escape constant_character_escape_ruby">\n</span><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
  <span class="keyword keyword_control keyword_control_ruby">end</span>
<span class="keyword keyword_control keyword_control_ruby">end</span>

<span class="comment comment_line comment_line_number-sign comment_line_number-sign_ruby"><span class="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_ruby">#</span> Haml gettext parser
</span><span class="meta meta_module meta_module_ruby"><span class="keyword keyword_control keyword_control_module keyword_control_module_ruby">module</span> <span class="entity entity_name entity_name_type entity_name_type_module entity_name_type_module_ruby">HamlParser</span></span>
  <span class="keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby">module_function</span>

  <span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">target?</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">file</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
    <span class="support support_class support_class_ruby">File</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>extname<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>file<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span> <span class="keyword keyword_operator keyword_operator_comparison keyword_operator_comparison_ruby">==</span> <span class="string string_quoted string_quoted_double string_quoted_double_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_begin punctuation_definition_string_begin_ruby">"</span>.haml<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_end punctuation_definition_string_end_ruby">"</span></span>
  <span class="keyword keyword_control keyword_control_ruby">end</span>

  <span class="meta meta_function meta_function_method meta_function_method_with-arguments meta_function_method_with-arguments_ruby"><span class="keyword keyword_control keyword_control_def keyword_control_def_ruby">def</span> <span class="entity entity_name entity_name_function entity_name_function_ruby">parse</span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">(</span><span class="variable variable_parameter variable_parameter_function variable_parameter_function_ruby">file<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> ary <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="punctuation punctuation_section punctuation_section_array punctuation_section_array_ruby">[]</span></span><span class="punctuation punctuation_definition punctuation_definition_parameters punctuation_definition_parameters_ruby">)</span></span>
    haml <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> <span class="support support_class support_class_ruby">Haml</span><span class="punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby">::</span><span class="support support_class support_class_ruby">Engine</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span><span class="keyword keyword_other keyword_other_special-method keyword_other_special-method_ruby">new</span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="support support_class support_class_ruby">IO</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>readlines<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>file<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>join<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
    code <span class="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_ruby">=</span> haml<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>precompiled<span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>split<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="string string_regexp string_regexp_classic string_regexp_classic_ruby"><span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_ruby">/</span>$<span class="punctuation punctuation_definition punctuation_definition_string punctuation_definition_string_ruby">/</span></span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
    <span class="support support_class support_class_ruby">GetText</span><span class="punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby">::</span><span class="support support_class support_class_ruby">RubyParser</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>parse_lines<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span>file<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> code<span class="punctuation punctuation_separator punctuation_separator_object punctuation_separator_object_ruby">,</span> ary<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span>
  <span class="keyword keyword_control keyword_control_ruby">end</span>
<span class="keyword keyword_control keyword_control_ruby">end</span>

<span class="support support_class support_class_ruby">GetText</span><span class="punctuation punctuation_separator punctuation_separator_other punctuation_separator_other_ruby">::</span><span class="support support_class support_class_ruby">RGetText</span><span class="punctuation punctuation_separator punctuation_separator_method punctuation_separator_method_ruby">.</span>add_parser<span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">(</span><span class="variable variable_other variable_other_constant variable_other_constant_ruby">HamlParser</span><span class="punctuation punctuation_section punctuation_section_function punctuation_section_function_ruby">)</span></span></pre>
<p>So this is it. Have fun with nice and clean templates that are translated on the fly</p>
<h2>See &amp; get more&#8230;</h2>
<p>You can find more recent and complete code at my <a href="http://github.com/nanoant/sinatra-hat">Sinatra Hat</a> GitHub hosted Ruby gem project.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nanoant.com/programming/haml-gettext-automagic-translation/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
