<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -22,6 +22,7 @@ In addition to the web UI this plugin adds the following rake tasks:
 translate:lost_in_translation
 translate:merge_keys
 translate:google
+translate:changed
 
 The lost_in_translation task shows you any I18n keys in your code that are do not have translations in the YAML file for your default locale, i.e. config/locales/sv.yml.
 
@@ -29,6 +30,8 @@ The merge_keys task is supposed to be used in conjunction with Sven Fuch's Rails
 
 The google task is used for auto translating from one locale to another using Google Translate.
 
+The changed rake task can show you between one YAML file to another which keys have had their texts changed.
+
 Installation
 =========
 Obtain the source with:</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -28,6 +28,33 @@ class Translate::Keys
   
   # Convert something like:
   # 
+  # {
+  #  :pressrelease =&gt; {
+  #    :label =&gt; {
+  #      :one =&gt; &quot;Pressmeddelande&quot;
+  #    }
+  #   }
+  # }
+  # 
+  # to:
+  # 
+  #  {'pressrelease.label.one' =&gt; &quot;Pressmeddelande&quot;}
+  #
+  def self.to_shallow_hash(hash)
+    hash.inject({}) do |shallow_hash, (key, value)|
+      if value.is_a?(Hash)
+        to_shallow_hash(value).each do |sub_key, sub_value|
+          shallow_hash[[key, sub_key].join(&quot;.&quot;)] = sub_value
+        end
+      else
+        shallow_hash[key.to_s] = value
+      end
+      shallow_hash
+    end
+  end
+  
+  # Convert something like:
+  # 
   #  {'pressrelease.label.one' =&gt; &quot;Pressmeddelande&quot;}
   # 
   # to:
@@ -41,7 +68,7 @@ class Translate::Keys
   # }
   def self.to_deep_hash(hash)    
     hash.inject({}) do |deep_hash, (key, value)|
-      keys = key.split('.').reverse
+      keys = key.to_s.split('.').reverse
       leaf_key = keys.shift
       key_hash = keys.inject({leaf_key.to_sym =&gt; value}) { |hash, key| {key.to_sym =&gt; hash} }
       deep_merge!(deep_hash, key_hash)</diff>
      <filename>lib/translate/keys.rb</filename>
    </modified>
    <modified>
      <diff>@@ -53,21 +53,13 @@ describe Translate::Keys do
 
   describe &quot;to_deep_hash&quot; do
     it &quot;convert shallow hash with dot separated keys to deep hash&quot; do
-      Translate::Keys.to_deep_hash({
-        'pressrelease.label.one' =&gt; &quot;Pressmeddelande&quot;,
-        'pressrelease.label.other' =&gt; &quot;Pressmeddelanden&quot;,
-        'article' =&gt; &quot;Artikel&quot;,
-        'category' =&gt; ''
-      }).should == {
-        :pressrelease =&gt; {
-          :label =&gt; {
-            :one =&gt; &quot;Pressmeddelande&quot;,
-            :other =&gt; &quot;Pressmeddelanden&quot;
-          }
-        },
-        :article =&gt; &quot;Artikel&quot;,
-        :category =&gt; ''
-      }
+      Translate::Keys.to_deep_hash(shallow_hash).should == deep_hash
+    end
+  end
+  
+  describe &quot;to_shallow_hash&quot; do
+    it &quot;converts a deep hash to a shallow one&quot; do
+      Translate::Keys.to_shallow_hash(deep_hash).should == shallow_hash
     end
   end
 
@@ -77,6 +69,28 @@ describe Translate::Keys do
   #
   ##########################################################################
   
+  def shallow_hash
+    {
+      'pressrelease.label.one' =&gt; &quot;Pressmeddelande&quot;,
+      'pressrelease.label.other' =&gt; &quot;Pressmeddelanden&quot;,
+      'article' =&gt; &quot;Artikel&quot;,
+      'category' =&gt; ''
+    }    
+  end
+  
+  def deep_hash
+    {
+      :pressrelease =&gt; {
+        :label =&gt; {
+          :one =&gt; &quot;Pressmeddelande&quot;,
+          :other =&gt; &quot;Pressmeddelanden&quot;
+        }
+      },
+      :article =&gt; &quot;Artikel&quot;,
+      :category =&gt; ''
+    }    
+  end
+  
   def i18n_files_dir
     File.join(File.dirname(__FILE__), &quot;files&quot;, &quot;translate&quot;)
   end</diff>
      <filename>spec/keys_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -139,4 +139,22 @@ namespace :translate do
     puts &quot;\nTime elapsed: #{(((Time.now - start_at) / 60) * 10).to_i / 10.to_f} minutes&quot;    
     Translate::Storage.new(ENV['TO'].to_sym).write_to_file
   end
+
+  desc &quot;List keys that have changed I18n texts between YAML file ENV['FROM_FILE'] and YAML file ENV['TO_FILE']. Set ENV['VERBOSE'] to see changes&quot;
+  task :changed =&gt; :environment do
+    from_hash = Translate::Keys.to_shallow_hash(Translate::File.new(ENV['FROM_FILE']).read)
+    to_hash = Translate::Keys.to_shallow_hash(Translate::File.new(ENV['TO_FILE']).read)
+    from_hash.each do |key, from_value|
+      if (to_value = to_hash[key]) &amp;&amp; to_value != from_value
+        key_without_locale = key[/^[^.]+\.(.+)$/, 1]
+        if ENV['VERBOSE']
+          puts &quot;KEY: #{key_without_locale}&quot;
+          puts &quot;FROM VALUE: '#{from_value}'&quot;
+          puts &quot;TO VALUE: '#{to_value}'&quot;
+        else
+          puts key_without_locale
+        end
+      end      
+    end
+  end
 end</diff>
      <filename>tasks/translate.rake</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e01c84ba7cb5a801ad99363b8abf3f9bc341bbea</id>
    </parent>
  </parents>
  <author>
    <name>Peter Marklund</name>
    <email>peter_marklund@fastmail.fm</email>
  </author>
  <url>http://github.com/newsdesk/translate/commit/1f8ebd683b5bfb0fe3f21ece8d754e58f5401ef4</url>
  <id>1f8ebd683b5bfb0fe3f21ece8d754e58f5401ef4</id>
  <committed-date>2009-08-29T03:41:21-07:00</committed-date>
  <authored-date>2009-08-29T03:41:21-07:00</authored-date>
  <message>Added rake task translate:changed that can show you from one YAML file to another which keys have had their texts changed</message>
  <tree>806ae78491def41c889354282dcc78d25548b2e3</tree>
  <committer>
    <name>Peter Marklund</name>
    <email>peter_marklund@fastmail.fm</email>
  </committer>
</commit>
