2 # This is a wrapper to msgmerge, it executes msgmerge with the given arguments, and
3 # if msgmerge output is empty, prints the content of the file named the first
4 # argument. otherwise it prints the output of msgmerge. The wrapper should be
5 # "compatible" with the real msgmerge if msgmerge output is non-empty, or if the
6 # first argument is the defpo file (instead of an option, or --)
8 # The path to msgmerge can be specified in env variable REAL_MSGMERGE_PATH
10 # The purpose is to provide a workaround for ruby-gettext, which treats empty output
11 # from msgmerge as error in the po file, where it should mean that no modification
12 # is needed to the defpo. For updates on the issue follow
13 # http://rubyforge.org/pipermail/gettext-users-en/2008-June/000094.html
16 msgmerge = ENV['REAL_MSGMERGE_PATH'] || 'msgmerge'
18 output = `#{msgmerge} #{defpo} #{ARGV.join ' '}`
19 output = File.read(defpo) if output.empty?