1#!/bin/sh
2
3#
4# Attempt to get a list of all messages displayed in the
5# Netmagis source code, and compare this list with the
6# French translation.
7#
8# The list extracted from source code is not exact, since
9# English messages in the code can reside in variables and
10# cannot be found by the regexp which catch patterns such
11# as [mc "string constant"...]
12#
13# History:
14#   2013/03/?? : pda/jean : design
15#   2013/06/02 : pda      : documented and added to the repo
16#
17
18MSGFILE=common/msgs/fr.msg
19
20TMP1=/tmp/chkmsg.$$.used
21TMP2=/tmp/chkmsg.$$.defined
22
23#
24# Get all messages used in the Netmagis code
25#
26
27grep -hr "\[mc [\"{]" * \
28    | sed \
29	-e 's/.*\[[m]c "\([^"]*\)".*/\1/' \
30	-e 's/.*\[[m]c {\([^}]*\)}.*/\1/' \
31    | sort --ignore-case \
32    | uniq \
33    > $TMP1
34
35#
36# Get all messages defined in the message file
37#
38
39sed -n \
40	-e '/^ *$/d' \
41	-e 's/^ {\([^}]*\)}.*/\1/p' \
42	-e 's/^ \([^ ][^ ]*\) .*/\1/p' \
43	$MSGFILE \
44    | sort --ignore-case \
45    > $TMP2
46
47echo "< used > defined"
48diff $TMP1 $TMP2
49
50#
51# Get all messages used in the Netmagis code, but hidden by a variable
52#
53
54grep -r '\[mc \$' * | grep -v grep
55
56rm -f $TMP1 $TMP2
57