summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorYaohan Chen <yaohan.chen@gmail.com>2008-06-07 15:48:53 -0400
committerYaohan Chen <yaohan.chen@gmail.com>2008-06-07 15:50:45 -0400
commitdd64d68b79cc41d3457c4abb6e2ec998b9721df8 (patch)
treebc9602676d3e328928cc6f0a829821367ed5884e /bin
parentcaffbfa94b84569fb64ed6ecb68f9ca960deca2a (diff)
add wrapper for msgmerge to workaround gettext bug with "empty" pot files
Diffstat (limited to 'bin')
-rwxr-xr-xbin/msgmerge-wrapper.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/bin/msgmerge-wrapper.rb b/bin/msgmerge-wrapper.rb
new file mode 100755
index 00000000..975107e3
--- /dev/null
+++ b/bin/msgmerge-wrapper.rb
@@ -0,0 +1,21 @@
+#!/usr/bin/ruby
+# This is a wrapper to msgmerge, it executes msgmerge with the given arguments, and
+# if msgmerge output is empty, prints the content of the file named the first
+# argument. otherwise it prints the output of msgmerge. The wrapper should be
+# "compatible" with the real msgmerge if msgmerge output is non-empty, or if the
+# first argument is the defpo file (instead of an option, or --)
+#
+# The path to msgmerge can be specified in env variable REAL_MSGMERGE_PATH
+#
+# The purpose is to provide a workaround for ruby-gettext, which treats empty output
+# from msgmerge as error in the po file, where it should mean that no modification
+# is needed to the defpo. For updates on the issue follow
+# http://rubyforge.org/pipermail/gettext-users-en/2008-June/000094.html
+
+
+msgmerge = ENV['REAL_MSGMERGE_PATH'] || 'msgmerge'
+defpo = ARGV.shift
+output = `#{msgmerge} #{defpo} #{ARGV.join ' '}`
+output = File.read(defpo) if output.empty?
+STDOUT.write output
+