|
Revision 43fee5acf9db25c238011c2fb37195bb70600431, 0.9 kB
(checked in by Yaohan Chen <yaohan.chen@gmail.com>, 5 months ago)
|
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
|
- Property mode set to
100755
|
| Line | |
|---|
| 1 |
#!/usr/bin/ruby |
|---|
| 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 --) |
|---|
| 7 |
# |
|---|
| 8 |
# The path to msgmerge can be specified in env variable REAL_MSGMERGE_PATH |
|---|
| 9 |
# |
|---|
| 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 |
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
msgmerge = ENV['REAL_MSGMERGE_PATH'] || 'msgmerge' |
|---|
| 17 |
defpo = ARGV.shift |
|---|
| 18 |
output = `#{msgmerge} #{defpo} #{ARGV.join ' '}` |
|---|
| 19 |
output = File.read(defpo) if output.empty? |
|---|
| 20 |
STDOUT.write output |
|---|
| 21 |
|
|---|