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 language's .po from scratch
9 # - To create a partucular language's .po from existing translations
14 LOCALE_DIR = File.dirname(__FILE__) + '/../../config/locales/'
16 def iterate(hash, fhash={}, path='')
18 unless fhash.has_key? key
22 iterate(val, fhash[key], path+key+':')
24 puts "msgctxt \"#{path}#{key}\""
25 puts "msgid \"#{val}\""
26 puts "msgstr \"#{fhash[key]}\""
34 oth = YAML::load_file(LOCALE_DIR+language+'.yml')
38 en = YAML::load_file(LOCALE_DIR+'en.yml')
39 iterate(en['en'], oth)