Recalculate margins size when changing font
[geany-mirror.git] / po / intl_stats.sh
blob5c4e72d86254d6e327d444d23596df998cf05f8b
1 #!/bin/sh
3 # Little shell script to display some basic statistics about Geany's translation
4 # files. It also checks the menu accelerators.
6 # Copyright 2007 The Geany contributors
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 check_accelerators=""
24 linguas=""
25 me=`basename $0`
28 usage()
30 echo "usage: $me [OPTION] [languages...]"
31 echo
32 echo "OPTIONs are:"
33 echo "-h --help this help screen"
34 echo "-a --accelerators check also for menu accelerators"
35 echo "languages list of language codes which should be tested"
36 echo
37 echo "example: $me -a de fr hu"
41 # parse cmd line arguments
42 while [ $# -gt 0 ]
44 case $1 in
45 --accelerators)
46 check_accelerators="--check-accelerators=_"
48 -a)
49 check_accelerators="--check-accelerators=_"
51 --help)
52 usage;
53 exit 1;
55 -h)
56 usage;
57 exit 1;
60 linguas="$linguas "$1
62 esac
63 shift
64 done
68 # if no languages where specified on the command line, take all listed languages in LINGUAS
69 if [ -z "$linguas" ]
70 then
71 linguas=`sed -e '/^#/d' po/LINGUAS`
74 # dash and zsh don't need the -e switch to echo, bash does
75 # maybe there is a better way to detect whether we are running on a bash
76 eswitch=""
77 if [ "$BASH" ]
78 then
79 eswitch="-e"
82 # do the work
83 if [ $check_accelerators ]
84 then
85 for lang in $linguas
87 msgfmt --check --statistics $check_accelerators po/$lang.po;
88 done
89 else
90 for lang in $linguas
92 # maybe the regexp can be optimized, regexps are not my best friends
93 creationdate=`grep "PO-Revision-Date:" po/$lang.po | sed 's/.*: \([0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\} [0-9]\{2\}:[0-9]\{2\}[+|-][0-9]\{4\}\).*/\1/'`
94 printf "%s %s\t(%s):\t" "$eswitch" "$lang" "$creationdate"
95 msgfmt --check --statistics po/$lang.po;
96 done