<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Haml + Gettext = automagic translation</title>
	<atom:link href="http://www.nanoant.com/programming/haml-gettext-automagic-translation/feed" rel="self" type="application/rss+xml" />
	<link>http://www.nanoant.com/programming/haml-gettext-automagic-translation</link>
	<description>Yet another self-employee site &#38; blog</description>
	<lastBuildDate>Wed, 16 Nov 2011 11:46:38 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: Language independant translator using haml parser &#124; Josh Software &#8211; Where Programming is an Art!</title>
		<link>http://www.nanoant.com/programming/haml-gettext-automagic-translation/comment-page-1#comment-11826</link>
		<dc:creator>Language independant translator using haml parser &#124; Josh Software &#8211; Where Programming is an Art!</dc:creator>
		<pubDate>Mon, 29 Aug 2011 18:05:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.nanoant.com/?p=290#comment-11826</guid>
		<description>[...] google&#8217;d and I found some good reference here. Using this reference I made necessary changes  for parsing my .haml pages and enable for [...]</description>
		<content:encoded><![CDATA[<p>[...] google&#8217;d and I found some good reference here. Using this reference I made necessary changes  for parsing my .haml pages and enable for [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Colin Dean</title>
		<link>http://www.nanoant.com/programming/haml-gettext-automagic-translation/comment-page-1#comment-6070</link>
		<dc:creator>Colin Dean</dc:creator>
		<pubDate>Sun, 27 Mar 2011 19:22:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.nanoant.com/?p=290#comment-6070</guid>
		<description>Thanks for creating this. It&#039;s a great tool.

However, I&#039;m having trouble figuring out where in my Sinatra app to put the FastGettext.add_text_domain and .text_domain call/set.

I&#039;m using bundler to manage gems and have sinatra-hat and fast_gettext in my Gemfile. I also have gettext for :development so I can use its tools.

Inside my app file:

include FastGettext::Translation
require &#039;gettext/haml&#039;

Then, to configure FastGettext, I&#039;ve got in in a configure block inside the class definition,

configure do
  FastGettext.add_text_domain(&#039;uio&#039;, :path =&gt; &#039;locale&#039;)
  FastGettext.text_domain = &#039;uio&#039;
end


but I get this when I load the page:

FastGettext::Storage::NoTextDomainConfigured at /
Current textdomain (nil) was not added, use FastGettext.add_text_domain !

I&#039;ve tried adding what&#039;s in that configure to just under where I&#039;m requiring gettext/haml, but to no avail.

Thoughts?</description>
		<content:encoded><![CDATA[<p>Thanks for creating this. It&#8217;s a great tool.</p>
<p>However, I&#8217;m having trouble figuring out where in my Sinatra app to put the FastGettext.add_text_domain and .text_domain call/set.</p>
<p>I&#8217;m using bundler to manage gems and have sinatra-hat and fast_gettext in my Gemfile. I also have gettext for :development so I can use its tools.</p>
<p>Inside my app file:</p>
<p>include FastGettext::Translation<br />
require &#8216;gettext/haml&#8217;</p>
<p>Then, to configure FastGettext, I&#8217;ve got in in a configure block inside the class definition,</p>
<p>configure do<br />
  FastGettext.add_text_domain(&#8216;uio&#8217;, :path =&gt; &#8216;locale&#8217;)<br />
  FastGettext.text_domain = &#8216;uio&#8217;<br />
end</p>
<p>but I get this when I load the page:</p>
<p>FastGettext::Storage::NoTextDomainConfigured at /<br />
Current textdomain (nil) was not added, use FastGettext.add_text_domain !</p>
<p>I&#8217;ve tried adding what&#8217;s in that configure to just under where I&#8217;m requiring gettext/haml, but to no avail.</p>
<p>Thoughts?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Igor</title>
		<link>http://www.nanoant.com/programming/haml-gettext-automagic-translation/comment-page-1#comment-575</link>
		<dc:creator>Igor</dc:creator>
		<pubDate>Wed, 21 Jul 2010 18:09:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.nanoant.com/?p=290#comment-575</guid>
		<description>Adam, in my code on github you can check the solution. I took the second approach and instead forced HAML to keep translate(&quot;phrase&quot;) calls within the template. So there is a single template for the whole app locales, but the keys which can be translated are stored within the template not as a plain text but as a &#039;translate&#039; method calls.
This gives some performance degradation of course, but its fine for my project so far.</description>
		<content:encoded><![CDATA[<p>Adam, in my code on github you can check the solution. I took the second approach and instead forced HAML to keep translate(&#8220;phrase&#8221;) calls within the template. So there is a single template for the whole app locales, but the keys which can be translated are stored within the template not as a plain text but as a &#8216;translate&#8217; method calls.<br />
This gives some performance degradation of course, but its fine for my project so far.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam</title>
		<link>http://www.nanoant.com/programming/haml-gettext-automagic-translation/comment-page-1#comment-556</link>
		<dc:creator>Adam</dc:creator>
		<pubDate>Wed, 23 Jun 2010 12:36:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.nanoant.com/?p=290#comment-556</guid>
		<description>&lt;strong&gt;Igor: &lt;/strong&gt;Thanks for a note. Sorry I haven&#039;t replied your previous post. Did you managed to do it for several locales? I believe the trick was to mod HAML a bit so the stored compiled templates are separate per each locale, so adding locale code prefix to compiled template method name should make it.</description>
		<content:encoded><![CDATA[<p><strong>Igor: </strong>Thanks for a note. Sorry I haven&#8217;t replied your previous post. Did you managed to do it for several locales? I believe the trick was to mod HAML a bit so the stored compiled templates are separate per each locale, so adding locale code prefix to compiled template method name should make it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Igor</title>
		<link>http://www.nanoant.com/programming/haml-gettext-automagic-translation/comment-page-1#comment-555</link>
		<dc:creator>Igor</dc:creator>
		<pubDate>Wed, 23 Jun 2010 12:32:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.nanoant.com/?p=290#comment-555</guid>
		<description>If of any use, here: &lt;a href=&quot;http://github.com/cail/haml_i18n&quot; rel=&quot;nofollow&quot;&gt;http://github.com/cail/haml_i18n&lt;/a&gt; is practically the same code but as a rails plugin and using i18n, not gettext.</description>
		<content:encoded><![CDATA[<p>If of any use, here: <a href="http://github.com/cail/haml_i18n" rel="nofollow">http://github.com/cail/haml_i18n</a> is practically the same code but as a rails plugin and using i18n, not gettext.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Igor</title>
		<link>http://www.nanoant.com/programming/haml-gettext-automagic-translation/comment-page-1#comment-483</link>
		<dc:creator>Igor</dc:creator>
		<pubDate>Tue, 22 Dec 2009 14:24:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.nanoant.com/?p=290#comment-483</guid>
		<description>Hi. Tried to adapt your solution (used i18n however).
However found the next flaw with your hack: HAML compiles the template and includes translated texts into the compiled form as a plain text.
This has a consequence that template only adapts to a single locale. Meaning different users (or a single user changing its locale dynamically) will see the very first compiled localization, not different.

There are basically two solutions to this problem. First - it is possible to somehow tell Rails template system to compile separate template for each locale. However that requires monkeyhacking and not quite straightforward.

Another way (which I think I&#039;ll choose) is not to return plain text within your push_plain/parse_tag, but return a push_script(&quot;= _(&#039;#{text}&#039;)&quot;) instead and force HAML to dynamically translate stuff all the time.

Or, is there any other solutions?</description>
		<content:encoded><![CDATA[<p>Hi. Tried to adapt your solution (used i18n however).<br />
However found the next flaw with your hack: HAML compiles the template and includes translated texts into the compiled form as a plain text.<br />
This has a consequence that template only adapts to a single locale. Meaning different users (or a single user changing its locale dynamically) will see the very first compiled localization, not different.</p>
<p>There are basically two solutions to this problem. First &#8211; it is possible to somehow tell Rails template system to compile separate template for each locale. However that requires monkeyhacking and not quite straightforward.</p>
<p>Another way (which I think I&#8217;ll choose) is not to return plain text within your push_plain/parse_tag, but return a push_script(&#8220;= _(&#8216;#{text}&#8217;)&#8221;) instead and force HAML to dynamically translate stuff all the time.</p>
<p>Or, is there any other solutions?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hasan Tan</title>
		<link>http://www.nanoant.com/programming/haml-gettext-automagic-translation/comment-page-1#comment-455</link>
		<dc:creator>Hasan Tan</dc:creator>
		<pubDate>Mon, 29 Jun 2009 20:44:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.nanoant.com/?p=290#comment-455</guid>
		<description>been looking for this information. Thank you very much...</description>
		<content:encoded><![CDATA[<p>been looking for this information. Thank you very much&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

