<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/translation_support.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,73 +1,27 @@
 namespace :radiant do
   namespace :i18n do
-    # Define locales root
-    language_root = &quot;#{RADIANT_ROOT}/config/locales/&quot;
     
+    desc &quot;Syncs all available translations to the English master&quot;
     task :sync =&gt; :environment do
-      words = get_translation_keys(language_root)
-      Dir[&quot;#{language_root}*.yml&quot;].each do |filename|
-        next if filename.match('_available_tags')
-        basename = File.basename(filename, '.yml')
-        puts &quot;Syncing #{basename}&quot;
-        (comments, other) = read_file(filename, basename)
-        words.each { |k,v| other[k] ||= words[k] }  # Initializing hash variable as empty if it does not exist
-        other.delete_if { |k,v| !words[k] }         # Remove if not defined in en.yml
-        write_file(filename, basename, comments, other)
+      # All places Radiant can store locales 
+      locale_paths = Radiant::AvailableLocales.locale_paths
+      # The main translation root, basically where English is kept
+      language_root = &quot;#{RADIANT_ROOT}/config/locales&quot;
+      words = TranslationSupport.get_translation_keys(language_root)
+      locale_paths.each do |path|
+        if path == language_root || path.match('i18n_')
+          Dir[&quot;#{path}/*.yml&quot;].each do |filename|
+            next if filename.match('_available_tags')
+            basename = File.basename(filename, '.yml')
+            puts &quot;Syncing #{basename}&quot;
+            (comments, other) = TranslationSupport.read_file(filename, basename)
+            words.each { |k,v| other[k] ||= words[k] }  # Initializing hash variable as empty if it does not exist
+            other.delete_if { |k,v| !words[k] }         # Remove if not defined in en.yml
+            TranslationSupport.write_file(filename, basename, comments, other)
+          end
+        end 
       end
     end
     
-    task :new =&gt; :environment do
-      if !ENV['LOCALE'] || ENV['LOCALE'] == ''
-        print &quot;You must provide a valid LOCALE value, for example:\nrake radiant:i18:new LOCALE=pt-PT\n&quot;
-        exit
-      end
-      write_file(&quot;#{language_root}/#{ENV['LOCALE']}.yml&quot;, &quot;#{ENV['LOCALE']}&quot;, '---', get_translation_keys(language_root))
-      # print &quot;Also, download the rails translation from: http://github.com/svenfuchs/rails-i18n/tree/master/rails/locale\n&quot;
-    end
-        
-  end
-end
-
-#Retrieve US word set
-def get_translation_keys(language_root, suffix=nil)
-  (dummy_comments, words) = read_file(&quot;#{language_root}en#{suffix}.yml&quot;, 'en')
-  words
-end
-
-#Retrieve comments, translation data in hash form
-def read_file(filename, basename)
-  (comments, data) = IO.read(filename).split(/\n#{basename}:\s*\n/)   #Add error checking for failed file read?
-  return comments, create_hash(data, basename)
-end
-
-#Creates hash of translation data
-def create_hash(data, basename)
-  words = Hash.new
-  return words if !data
-  parent = Array.new
-  previous_key = 'base'
-  data.split(&quot;\n&quot;).each do |w|
-    next if w.strip.blank?
-    (key, value) = w.split(':', 2)
-    value ||= ''
-    shift = (key =~ /\w/)/2 - parent.size                             #Determine level of current key in comparison to parent array
-    key = key.sub(/^\s+/,'')
-    parent &lt;&lt; previous_key if shift &gt; 0                               #If key is child of previous key, add previous key as parent
-    (shift*-1).times { parent.pop } if shift &lt; 0                      #If key is not related to previous key, remove parent keys
-    previous_key = key                                                #Track key in case next key is child of this key
-    words[parent.join(':')+':'+key] = value
   end
-  words
 end
-
-#Writes to file from translation data hash structure
-def write_file(filename,basename,comments,words)
-  File.open(filename, &quot;w&quot;) do |log|
-    log.puts(comments+&quot;\n&quot;+basename+&quot;: \n&quot;)
-    words.sort.each do |k,v|
-      keys = k.split(':')
-      (keys.size-1).times { keys[keys.size-1] = '  ' + keys[keys.size-1] }   #Add indentation for children keys
-      log.puts(keys[keys.size-1]+':'+v+&quot;\n&quot;)
-    end
-  end
-end
\ No newline at end of file</diff>
      <filename>lib/tasks/translate.rake</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5f8acb5e4c7445d43f5e763268483f708865cc26</id>
    </parent>
  </parents>
  <author>
    <name>Keith</name>
    <email>keith@keithbingman.com</email>
  </author>
  <url>http://github.com/radiant/radiant/commit/e7b08070dc2ada7fedd57031e0b7d28ecf669901</url>
  <id>e7b08070dc2ada7fedd57031e0b7d28ecf669901</id>
  <committed-date>2009-10-16T02:34:12-07:00</committed-date>
  <authored-date>2009-10-16T02:34:12-07:00</authored-date>
  <message>improve i18n task to sync langauges to include language packs, that is extensions that start with i18n_</message>
  <tree>f91110c7752f9295ec0311bf84c7036d17c7b495</tree>
  <committer>
    <name>Keith</name>
    <email>keith@keithbingman.com</email>
  </committer>
</commit>
