aboutsummaryrefslogtreecommitdiffstats
path: root/bin/gettext-extract
diff options
context:
space:
mode:
Diffstat (limited to 'bin/gettext-extract')
-rwxr-xr-xbin/gettext-extract53
1 files changed, 53 insertions, 0 deletions
diff --git a/bin/gettext-extract b/bin/gettext-extract
new file mode 100755
index 000000000..70ed66a4f
--- /dev/null
+++ b/bin/gettext-extract
@@ -0,0 +1,53 @@
+#!/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.1 2008-05-06 10:01:23 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
+
+
+# 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=_ --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: Email templates - should be in >1 language...
+# And the XSL page too.
+