Created
August 6, 2013 17:01
-
-
Save whalesalad/6166393 to your computer and use it in GitHub Desktop.
Quick and dirty Rakefile for a Wordpress project I maintain. Automates the conversion of .po files to .mo files. In this example, it uses all the .po files in the ./lang directory. Also note that I installed gettext via homebrew so the msgfmt binary is not on my path. Rather than muck with my path and risk screwing up OS X's built-in gettext stu…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MSGFMT = "/usr/local/Cellar/gettext/0.18.2/bin/msgfmt" | |
task :export_mo do |t| | |
po_files = Dir.glob(File.dirname(__FILE__) + '/lang/*.po') | |
po_files.each do |po| | |
mo = po.gsub(/.po\Z/, '.mo') | |
sh "#{MSGFMT} -o '#{mo}' '#{po}'" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment