#!/usr/bin/env ruby1.8 strings = [] Dir.glob("**/*.gthtml") do |filename| File.open("./#{ filename }").each_line do |line| if line =~ /<%=[ \t]+translate[ \t]+'(([^\\']|\\.)*)'/ strings << $1 end end end puts <. */ #include #include static char *text[] = { EOF strings.uniq.sort.each do |string| puts "\tN_(\"#{ string.gsub('\\', '\\\\').gsub('"', '\\"') }\")," end puts <