/usr/bin/pocompendium is in translate-toolkit 1.10.0-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | #!/bin/bash
#
# Copyright 2004, 2005 Zuza Software Foundation
#
# This file is part of The Translate Toolkit.
#
# The Translate Toolkit is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# translate is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with translate; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Creates a PO Compendium ie a merge of all PO files in a given directory and
# subdirectory. If conflicts in the merge are found then these are
# combined and marked fuzzy.
function print_usage() {
echo "Usage: `basename $0` [options] output.po <-d directory(s)|file(s)>"
echo " The first parameter is the output file, standard output if the output file is '-'."
echo " Any number of directories may be specified for input files."
echo " Options:"
echo " --invert|v Creates an inverse compendium with msgid and msgstr swapped"
echo " --errors|e Only ouput msg bundles that have errors"
echo " --correct|c Only ouput msg bundles that are correctly translated"
echo " --ignore-case|i Drops all strings to lowercase"
echo " --strip-accel-tilde|-st Strip all tilde (~) accelerator characters"
echo " --strip-accel-amp|-sa Strip all ampersand (&) accelerator characters"
echo " --strip-accel-under|-su Strip all underscore (_) accelerator characters"
exit 1
}
option_invert=0
option_errors=0
option_correct=0
option_ignorecase=0
option_accel_ooo=0
option_accel_moz=0
option_accel_gnome=0
for true
do
case $1 in
--invert|-v) option_invert=1
shift
;;
--errors|-e) option_errors=1
if [ $option_correct -eq 1 ]; then
usage
fi
shift
;;
--correct|-c) option_correct=1
if [ $option_errors -eq 1 ];
then
usage
fi
shift
;;
--ignore-case|-i) option_ignorecase=1
shift
;;
--strip-accel-tilde|-st) option_accel_ooo=1
shift
;;
--strip-accel-amp|-sa) option_accel_moz=1
shift
;;
--strip-accel-under|-su) option_accel_gnome=1
shift
;;
--*|-*) print_usage
;;
*) break
;;
esac
done
#--strip-end-punctuation|-p)
#--strip-all|-A)
#--good|-g)
if [ $# -lt 2 ]; then
print_usage
fi
output=$1
shift
tmp_dir=`mktemp -d tmp.XXXXXXXXXX`
if [ $1 == "-d" ]; then
shift
directories=$*
if [ $# -eq 0 ]; then
print_usage
fi
for dir in $directories
do
cp -rp $dir $tmp_dir
done
else
files=$*
for file in $files
do
mkdir -p $tmp_dir/`dirname $file`
cp -p $file $tmp_dir/`dirname $file`
done
fi
# Invert if requested
if [ $option_invert -eq 1 ] ; then
for po_file in `find $tmp_dir -name "*.po"`
do
stripped_name=`dirname $po_file`/`basename $po_file .po`
po_translated=${stripped_name}.translated.po
po_inverted=${stripped_name}.invert.po
msgattrib --translated $po_file > $po_translated
msghack --invert $po_translated > $po_inverted
rm $po_file $po_translated
done
fi
# Drop case to lowercase and apply other filters
UPPER=ABCDEFGHIJKLMNOPQRSTUVWXYZ
LOWER=abcdefghijklmnopqrstuvwxyz
if [ $option_ignorecase -eq 1 ]; then
sed_string=`echo "$sed_string y/$UPPER/$LOWER/;"`
fi
if [ $option_accel_ooo -eq 1 ]; then
sed_string=`echo "$sed_string s/~//;"`
fi
if [ $option_accel_moz -eq 1 ]; then
sed_string=`echo "$sed_string s/&//;"`
fi
if [ $option_accel_gnome -eq 1 ]; then
sed_string=`echo "$sed_string s/_//;"`
fi
if [ $option_ignorecase = 1 ]; then
for po_file in `find $tmp_dir -name "*.po"`
do
stripped_name=`dirname $po_file`/`basename $po_file .po`
po_lower=${stripped_name}.lower.po
msgfilter --keep-header -i $po_file sed -e "$sed_string" > $po_lower
rm $po_file
done
fi
msgcat -o $output `find $tmp_dir -name "*.po"` 2> >(egrep -v "warning: internationali.ed messages should not contain the .* escape sequence" >&2)
# Extract only errors if requested
if [ $option_errors -eq 1 ] ; then
tmp=`mktemp tmp.XXXXXXXXXX`
msgattrib --only-fuzzy $output > $tmp
mv $tmp $output
fi
# Extract only correct translations if requested
if [ $option_correct -eq 1 ] ; then
tmp=`mktemp tmp.XXXXXXXXXX`
msgattrib --translated --no-fuzzy -o $tmp $output 2> >(egrep -v "warning: internationali.ed messages should not contain the .* escape sequence" >&2) && mv $tmp $output
fi
rm -rf $tmp_dir
|