blob: d6c248fda7f3a42a53f718e300d517f629fe2272 (
plain)
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
|
#!/bin/bash
#
# bci/bin/gettext-extract
# Generate English language .po files from the source code and email templates,
# for FixMyStreet. Writes the output to appropriate .po files in locale/.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: matthew@mysociety.org; WWW: http://www.mysociety.org/
#
# $Id: gettext-extract,v 1.6 2009-05-27 15:27:18 matthew Exp $
if [ -e ../../locale ]
then
cd ../../
else if [ -e ../locale ]
then
cd ../
else if [ -e locale ]
then
cd .
else
echo "Please run with current directory bci/bin"
exit 1
fi
fi
fi
# Take chunk of text and escape each line in it for putting in catalogue
function plain_gettext_escape() {
IFS=""
while read LINE
do
LINE=${LINE//\"/\\\"}
echo \"$LINE\\n\"
done
}
# File to write to, clear it to start with
PO=locale/FixMyStreet.po
rm -f $PO
# Extract from Perl
xgettext --add-comments=TRANS --language=Perl --keyword=_ --keyword=nget:1,2 --from-code=utf-8 -o $PO perllib/mySociety/*.pm bci/perllib/*.pm bci/web/*.cgi bci/bin/send-reports
# Fix headers
TEMP=`tempfile`
cat $PO | sed "
s/SOME DESCRIPTIVE TITLE/FixMyStreet original .po file, autogenerated by gettext-extract/;
s/YEAR THE PACKAGE'S COPYRIGHT HOLDER/2008 UK Citizens Online Democracy/;
s/PACKAGE package/main FixMyStreet code/;
s/FIRST AUTHOR <EMAIL@ADDRESS>, YEAR./Matthew Somerville <matthew@mysociety.org>, 2008-04-15./;
s/PACKAGE VERSION/1.0/;
s/Report-Msgid-Bugs-To: /Report-Msgid-Bugs-To: matthew@mysociety.org/;
s/LL@li.org/team@fixmystreet.com/;
s/charset=CHARSET/charset=UTF-8/;
" >> $TEMP
mv $TEMP $PO
# XXX The XSL page needs including?
# Extract email templates
echo >> $PO
echo '#. Please leave the first word "Subject:" untranslated' >> $PO
for X in bci/templates/emails/*
do
# TODO: Should check for "*~" type filenames too, and do the *-livesimply case
# with wildcards rather than checking per template
if [ "$X" != "bci/templates/emails/eha" -a "$X" != "bci/templates/emails/CVS" -a "$X" != "bci/templates/emails/empty property-confirm" -a "$X" != "bci/templates/emails/submit-eha" -a "$X" != "bci/templates/emails/questionnaire-eha-4weeks" -a "$X" != "bci/templates/emails/questionnaire-eha-26weeks" ]
then
echo >> $PO
echo "#: $X" >> $PO
echo msgid \"\" >> $PO
cat $X | plain_gettext_escape >> $PO
echo msgstr \"\" >> $PO
fi
done
|