summaryrefslogtreecommitdiff
path: root/msgmerge-wrapper.rb
diff options
context:
space:
mode:
authorYaohan Chen <yaohan.chen@gmail.com>2008-06-20 16:36:00 -0400
committerYaohan Chen <yaohan.chen@gmail.com>2008-06-20 16:39:41 -0400
commit43fee5acf9db25c238011c2fb37195bb70600431 (patch)
tree11e1ce046d01924a334ae404cd037272c13a585b /msgmerge-wrapper.rb
parentbaf5e97c8b6471933cf950ef6122ffe58747a556 (diff)
move bin/msgmerge-wrapper.rb to top level, as it is not intended for installation
path/command for the msgmerge-wrapper can be adjusted with env var, if "ruby msgmerge-wrapper.rb" doesn't work on the platform
Diffstat (limited to 'msgmerge-wrapper.rb')
-rwxr-xr-xmsgmerge-wrapper.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/msgmerge-wrapper.rb b/msgmerge-wrapper.rb
new file mode 100755
index 00000000..975107e3
--- /dev/null
+++ b/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
+