2 # yaml2po, for converting RoR translation YAML to the standard gettext
 
   3 #          for eventual use with a translation site such as Transifex
 
   5 #  - To create a 'master' .pot
 
   6 #    yaml2po > translations.pot
 
   7 #  - To create a partucular language's .po
 
  12 LOCALE_DIR = File.dirname(__FILE__) + '/../config/locales/'
 
  14 def iterate(hash, fhash={}, path='')
 
  16     unless fhash.has_key? key
 
  20       iterate(val, fhash[key], path+key+':')
 
  22       puts "#: #{path}#{key}"
 
  23       puts "msgid \"#{val}\""
 
  24       puts "msgstr \"#{fhash[key]}\""
 
  32   oth = YAML::load_file(LOCALE_DIR+language+'.yml')
 
  36 en = YAML::load_file(LOCALE_DIR+'en.yml')
 
  37 iterate(en['en'], oth)