Debian Codegraph @

translation-canary/xgettext_werror.sh

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`. -e
2 #
3 # xgettext_werror.sh: Run xgettext and actually do something with the warnings
4 #
5 # xgettext prints out warnings for certain problems in translatable strings,
6 # such as format strings that cannot be translated due to position-based
7 # parameters. These warnings generally indicate something that needs to be
8 # addressed before the strings can be submitted for translation. This script
9 # exits with a status of 1 so that the warnings are not ignored as they scroll
10 # by in pages of build output.
11 #
12 # This script should be used in place of xgettext when rebuilding the .pot file,
13 # e.g. by setting XGETTEXT in po/Makevars.
14 #
15 # Copyright (C) 2015 Red Hat, Inc.
16 #
17 # This copyrighted material is made available to anyone wishing to use,
18 # modify, copy, or redistribute it subject to the terms and conditions of
19 # the GNU Lesser General Public License v.2, or (at your option) any later
20 # version. This program is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY expressed or implied, including the implied
22 # warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
23 # the GNU Lesser General Public License for more details. You should have
24 # received a copy of the GNU Lesser General Public License along with this
25 # program; if not, write to the Free Software Foundation, Inc., 51 Franklin
26 # Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat trademarks
27 # that are incorporated in the source code or documentation are not subject
28 # to the GNU Lesser General Public License and may only be used or
29 # replicated with the express permission of Red Hat, Inc.
30 #
31 # Red Hat Author(s): David Shea <[email protected]>
32
33 returncode=0
34
35 # Collect the output from xgettext. If xgettext fails, treat that as a failure
36 # Make sure that "warning:" doesn't get translated
37 xgettext_output="$(LC_MESSAGES=C xgettextscip-shell system . . xgettext. "$@" 2>&1)" || returncode=$?
38
39 # Look for warnings
40 if echoscip-shell system . . echo. "$xgettext_output" | awkscip-shell system . . awk. '/warning: / && !/fallback ITS rule/{rc=1}; END {exit !rc}scip-shell filesystem . . `/warning: / && !/fallback ITS rule/{rc=1}; END {exit !rc}`.'; then
41 returncode=1
42 fi
43
44 # Print the output and return
45 echoscip-shell system . . echo. "$xgettext_output"
46 exit $returncode