+opt = ARGV[0]
+if opt == "--all"
+ # Produce .po files for all langs, and a .pot template
+ po_dir = "#{LOCALE_DIR}po/"
+ Dir.mkdir(po_dir) unless File.directory?(po_dir)
+ Dir.glob("#{LOCALE_DIR}/*.yml") do |filename|
+ lang = File.basename(filename, ".yml")
+ unless lang == "en"
+ outfile = File.new("#{po_dir}#{lang}.po", "w")
+ lang2po(lang, outfile)
+ outfile.close
+ end
+ end
+ outfile = File.new("#{po_dir}rails_port.pot", "w")
+ iterate(EN["en"], {}, "", outfile)
+ outfile.close
+elsif opt
+ lang2po(opt)
+else
+ iterate(EN["en"])
+end