+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