<?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: Plugin: translatable_columns</title>
	<atom:link href="http://iain.nl/2008/09/plugin-translatable_columns/feed/" rel="self" type="application/rss+xml" />
	<link>http://iain.nl/2008/09/plugin-translatable_columns/</link>
	<description></description>
	<lastBuildDate>Thu, 29 Jul 2010 12:35:04 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Dmitry Polushkin</title>
		<link>http://iain.nl/2008/09/plugin-translatable_columns/comment-page-1/#comment-651</link>
		<dc:creator>Dmitry Polushkin</dc:creator>
		<pubDate>Sat, 02 Jan 2010 18:52:37 +0000</pubDate>
		<guid isPermaLink="false">http://iain.nl/?p=198#comment-651</guid>
		<description>Check out my model translation plugin: http://github.com/dmitry/has_translations
It uses little different approach.

Thanks,
Dmitry</description>
		<content:encoded><![CDATA[<p>Check out my model translation plugin: <a href="http://github.com/dmitry/has_translations" rel="nofollow">http://github.com/dmitry/has_translations</a><br />
It uses little different approach.</p>
<p>Thanks,<br />
Dmitry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Iain Hecker</title>
		<link>http://iain.nl/2008/09/plugin-translatable_columns/comment-page-1/#comment-551</link>
		<dc:creator>Iain Hecker</dc:creator>
		<pubDate>Thu, 08 Oct 2009 18:57:26 +0000</pubDate>
		<guid isPermaLink="false">http://iain.nl/?p=198#comment-551</guid>
		<description>How about something like:

&lt;pre lang=&quot;ruby&quot;&gt;
before_save :cleanup_fields

private

def cleanup_fields
  available_columns_of(&quot;description&quot;).each do &#124;column&#124;
    send(&quot;#{column}=&quot;, nil) if send(column).blank?
  end
end
&lt;/pre&gt;

You can also use the &lt;a href=&quot;http://mdeering.com/posts/019-activerecord-attribute-normalization-rails-plugin&quot; rel=&quot;nofollow&quot;&gt;attribute normalization plugin&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>How about something like:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">before_save <span style="color:#ff3333; font-weight:bold;">:cleanup_fields</span>
&nbsp;
private
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> cleanup_fields
  available_columns_of<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;description&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>column<span style="color:#006600; font-weight:bold;">|</span>
    send<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;#{column}=&quot;</span>, <span style="color:#0000FF; font-weight:bold;">nil</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">if</span> send<span style="color:#006600; font-weight:bold;">&#40;</span>column<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">blank</span>?
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>You can also use the <a href="http://mdeering.com/posts/019-activerecord-attribute-normalization-rails-plugin" rel="nofollow">attribute normalization plugin</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jujudellago</title>
		<link>http://iain.nl/2008/09/plugin-translatable_columns/comment-page-1/#comment-550</link>
		<dc:creator>jujudellago</dc:creator>
		<pubDate>Wed, 07 Oct 2009 19:56:48 +0000</pubDate>
		<guid isPermaLink="false">http://iain.nl/?p=198#comment-550</guid>
		<description>Hi,

I really like that plugin, just works the way I need it in most cases, for websites using 2-3 languages, in my case french, english and german.

One thing I really like to offer to my clients is simple forms where some datas wil be translated, some won&#039;t for example last name, first name, or company name would not be translated, while a presentation text could be written in 3 languages.

this is when I love to have for example 3 text areas, using transalted columns:
 
description_fr
description_en
description_de

letting my user decide in what language they wish to fill their description.

it works almost as I would expect, the use_default is fantastic, but I just have a problem: as the forms are submitted with all the transalted fields, if they are left blank the form, they are saved as blank string, instead of nil.

in that case, when the page containing the datas is loaded, instead of getting a default value it just gives me an empty string.

I made an ugly fix, in my model, using a &quot;before save&quot; in my model, but it&#039;s so ugly....

def before_save
   if self. description_fr.blank?
      self. description_fr=nil
  end
  if self. description_en.blank?
      self. description_en=nil
  end
 if self. description_de.blank?
      self. description_de=nil
  end
end


I&#039;m so bad with metaprogramming, can&#039;t figure out how to automatize such thing in the plugin, could you help ?

and... do you think what I&#039;m doing makes sense ?

kind regards</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I really like that plugin, just works the way I need it in most cases, for websites using 2-3 languages, in my case french, english and german.</p>
<p>One thing I really like to offer to my clients is simple forms where some datas wil be translated, some won&#8217;t for example last name, first name, or company name would not be translated, while a presentation text could be written in 3 languages.</p>
<p>this is when I love to have for example 3 text areas, using transalted columns:</p>
<p>description_fr<br />
description_en<br />
description_de</p>
<p>letting my user decide in what language they wish to fill their description.</p>
<p>it works almost as I would expect, the use_default is fantastic, but I just have a problem: as the forms are submitted with all the transalted fields, if they are left blank the form, they are saved as blank string, instead of nil.</p>
<p>in that case, when the page containing the datas is loaded, instead of getting a default value it just gives me an empty string.</p>
<p>I made an ugly fix, in my model, using a &#8220;before save&#8221; in my model, but it&#8217;s so ugly&#8230;.</p>
<p>def before_save<br />
   if self. description_fr.blank?<br />
      self. description_fr=nil<br />
  end<br />
  if self. description_en.blank?<br />
      self. description_en=nil<br />
  end<br />
 if self. description_de.blank?<br />
      self. description_de=nil<br />
  end<br />
end</p>
<p>I&#8217;m so bad with metaprogramming, can&#8217;t figure out how to automatize such thing in the plugin, could you help ?</p>
<p>and&#8230; do you think what I&#8217;m doing makes sense ?</p>
<p>kind regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gene</title>
		<link>http://iain.nl/2008/09/plugin-translatable_columns/comment-page-1/#comment-265</link>
		<dc:creator>Gene</dc:creator>
		<pubDate>Mon, 13 Apr 2009 17:24:59 +0000</pubDate>
		<guid isPermaLink="false">http://iain.nl/?p=198#comment-265</guid>
		<description>Nice plugin!

It works great when a few columns need to be translated to a couple of languages.  However, when many languages are required (20+) for most columns, this approach no longer scales.</description>
		<content:encoded><![CDATA[<p>Nice plugin!</p>
<p>It works great when a few columns need to be translated to a couple of languages.  However, when many languages are required (20+) for most columns, this approach no longer scales.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans</title>
		<link>http://iain.nl/2008/09/plugin-translatable_columns/comment-page-1/#comment-261</link>
		<dc:creator>Hans</dc:creator>
		<pubDate>Mon, 23 Mar 2009 17:50:46 +0000</pubDate>
		<guid isPermaLink="false">http://iain.nl/?p=198#comment-261</guid>
		<description>Just found another problem: if an object is serialized into a translated column the reference does not return the object but the raw yaml string.

Hans

BTW,
if you want to use Goldberg with translatable_columns you got to copy the two lines in init.rb into Goldbergs init.rb to initialize translatable_columns before Goldberg startup.</description>
		<content:encoded><![CDATA[<p>Just found another problem: if an object is serialized into a translated column the reference does not return the object but the raw yaml string.</p>
<p>Hans</p>
<p>BTW,<br />
if you want to use Goldberg with translatable_columns you got to copy the two lines in init.rb into Goldbergs init.rb to initialize translatable_columns before Goldberg startup.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans</title>
		<link>http://iain.nl/2008/09/plugin-translatable_columns/comment-page-1/#comment-260</link>
		<dc:creator>Hans</dc:creator>
		<pubDate>Mon, 23 Mar 2009 11:41:08 +0000</pubDate>
		<guid isPermaLink="false">http://iain.nl/?p=198#comment-260</guid>
		<description>Thanks for this plugin, which basically works great and is really simple to deal with.

I&#039;m trying to use translatable_columns to internationalize a Goldberg application. I started with the content_pages and Goldberg gets confused with saving pages. 
Another problem arises from Goldberg using find_by_sql in some places which seems not to be supported. Is there a simple way out or have I to go with the nasty workaround of inserting a translation in the sql string? 

Hans</description>
		<content:encoded><![CDATA[<p>Thanks for this plugin, which basically works great and is really simple to deal with.</p>
<p>I&#8217;m trying to use translatable_columns to internationalize a Goldberg application. I started with the content_pages and Goldberg gets confused with saving pages.<br />
Another problem arises from Goldberg using find_by_sql in some places which seems not to be supported. Is there a simple way out or have I to go with the nasty workaround of inserting a translation in the sql string? </p>
<p>Hans</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gravis</title>
		<link>http://iain.nl/2008/09/plugin-translatable_columns/comment-page-1/#comment-240</link>
		<dc:creator>Gravis</dc:creator>
		<pubDate>Thu, 18 Dec 2008 21:18:51 +0000</pubDate>
		<guid isPermaLink="false">http://iain.nl/?p=198#comment-240</guid>
		<description>Thanks Iain, it saved me a lot of time, I didn&#039;t think of such simple solution :)
I have a lot of localized model, and it&#039;s definitely the way to go.</description>
		<content:encoded><![CDATA[<p>Thanks Iain, it saved me a lot of time, I didn&#8217;t think of such simple solution :)<br />
I have a lot of localized model, and it&#8217;s definitely the way to go.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Iain Hecker</title>
		<link>http://iain.nl/2008/09/plugin-translatable_columns/comment-page-1/#comment-239</link>
		<dc:creator>Iain Hecker</dc:creator>
		<pubDate>Thu, 18 Dec 2008 09:00:18 +0000</pubDate>
		<guid isPermaLink="false">http://iain.nl/?p=198#comment-239</guid>
		<description>@Gravis: If this one time only migration is the problem, it&#039;s probably easier to temporarily comment out the validation, run the migration and then turn it on again.

You can also put some conditions around it:

&lt;pre lang=&quot;rails&quot;&gt;
class User &lt; ActiveRecord:Base
  if column_names.include?(&quot;title_en&quot;)
    translatable_columns :title
    validates_translation_of :title
  end
  # .......
end
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@Gravis: If this one time only migration is the problem, it&#8217;s probably easier to temporarily comment out the validation, run the migration and then turn it on again.</p>
<p>You can also put some conditions around it:</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> User <span style="color:#006600; font-weight:bold;">&lt;</span> ActiveRecord:Base
  <span style="color:#9966CC; font-weight:bold;">if</span> column_names.<span style="color:#9966CC; font-weight:bold;">include</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;title_en&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    translatable_columns <span style="color:#ff3333; font-weight:bold;">:title</span>
    validates_translation_of <span style="color:#ff3333; font-weight:bold;">:title</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#008000; font-style:italic;"># .......</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Gravis</title>
		<link>http://iain.nl/2008/09/plugin-translatable_columns/comment-page-1/#comment-237</link>
		<dc:creator>Gravis</dc:creator>
		<pubDate>Wed, 17 Dec 2008 16:18:52 +0000</pubDate>
		<guid isPermaLink="false">http://iain.nl/?p=198#comment-237</guid>
		<description>Maybe adding a boolean field in models, false by default, and set to true when the model has been migrated to a &quot;localized&quot; version ? validates_translation_of would check before everything this boolean value, and raise a warning (but still create the instance) if the model has not been localized yet.
My 2c</description>
		<content:encoded><![CDATA[<p>Maybe adding a boolean field in models, false by default, and set to true when the model has been migrated to a &#8220;localized&#8221; version ? validates_translation_of would check before everything this boolean value, and raise a warning (but still create the instance) if the model has not been localized yet.<br />
My 2c</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gravis</title>
		<link>http://iain.nl/2008/09/plugin-translatable_columns/comment-page-1/#comment-236</link>
		<dc:creator>Gravis</dc:creator>
		<pubDate>Wed, 17 Dec 2008 16:15:24 +0000</pubDate>
		<guid isPermaLink="false">http://iain.nl/?p=198#comment-236</guid>
		<description>Hi, thanks for the new plugin, this looks very great.
Anyway, I encounter some difficulties with migrations now. I have some migrations creating or updating values. Therefore, I can&#039;t reproduce a clean dev environment since the old creations will fails agains validates_translation_of (and translatable_columns will certainly cause problems too). I&#039;m not sure how to solve this (besides commenting all modifications in model files during migrations) :(

Thanks</description>
		<content:encoded><![CDATA[<p>Hi, thanks for the new plugin, this looks very great.<br />
Anyway, I encounter some difficulties with migrations now. I have some migrations creating or updating values. Therefore, I can&#8217;t reproduce a clean dev environment since the old creations will fails agains validates_translation_of (and translatable_columns will certainly cause problems too). I&#8217;m not sure how to solve this (besides commenting all modifications in model files during migrations) :(</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>
