Add plugin API functions to get/set document data
[geany-mirror.git] / po / intl_stats.sh
blobf6ea0058f6ea8d973badaa980d0bb0b11e7cd66f
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-2008 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
7 # Copyright 2007-2008 Frank Lanitz <enrico(dot)troeger(at)uvena(dot)de>
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 check_accelerators=""
25 linguas=""
26 me=`basename $0`
29 usage()
31 echo "usage: $me [OPTION] [languages...]"
32 echo
33 echo "OPTIONs are:"
34 echo "-h --help this help screen"
35 echo "-a --accelerators check also for menu accelerators"
36 echo "languages list of language codes which should be tested"
37 echo
38 echo "example: $me -a de fr hu"
42 # parse cmd line arguments
43 while [ $# -gt 0 ]
45 case $1 in
46 --accelerators)
47 check_accelerators="--check-accelerators=_"
49 -a)
50 check_accelerators="--check-accelerators=_"
52 --help)
53 usage;
54 exit 1;
56 -h)
57 usage;
58 exit 1;
61 linguas="$linguas "$1
63 esac
64 shift
65 done
69 # if no languages where specified on the command line, take all listed languages in LINGUAS
70 if [ -z "$linguas" ]
71 then
72 linguas=`sed -e '/^#/d' po/LINGUAS`
75 # dash and zsh don't need the -e switch to echo, bash does
76 # maybe there is a better way to detect whether we are running on a bash
77 eswitch=""
78 if [ "$BASH" ]
79 then
80 eswitch="-e"
83 # do the work
84 if [ $check_accelerators ]
85 then
86 for lang in $linguas
88 msgfmt --check --statistics $check_accelerators po/$lang.po;
89 done
90 else
91 for lang in $linguas
93 # maybe the regexp can be optimized, regexps are not my best friends
94 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/'`
95 printf "%s %s\t(%s):\t" "$eswitch" "$lang" "$creationdate"
96 msgfmt --check --statistics po/$lang.po;
97 done