Skip to content

Instantly share code, notes, and snippets.

@venj
Created July 30, 2012 09:29
Show Gist options
  • Save venj/3205856 to your computer and use it in GitHub Desktop.
Save venj/3205856 to your computer and use it in GitHub Desktop.
Process language string file
#!/usr/bin/env ruby
f = open ARGV[0]
o = open "out.strings", "w+"
lines = f.readlines
lines.each_slice(3) do |para|
regex = /\/\* (.*) \*\//i
chn = para[0].strip.match(regex)[1]
i = para[1].index("=") + 1
trans = para[1].strip[0..i] + '"' + chn + '";'
o.puts para[0].strip
o.puts trans
o.puts
end
f.close
o.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment