#!/bin/bash # # fixmystreet/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) 2011 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ if [ -e ../../locale ] then cd ../../ else if [ -e ../locale ] then cd ../ else if [ -e locale ] then cd . else echo "Please run with current directory fixmystreet/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.pl --gnu-gettext --verbose --output $PO --plugin perl=* --plugin tt2 --directory perllib --directory templates/web --directory db --directory bin # Fix headers TEMP=`tempfile` NOW=`date +"%Y-%m-%d %H:%M%z"` cat $PO | sed " s/SOME DESCRIPTIVE TITLE/FixMyStreet original .po file, autogenerated by gettext-extract/; s/YEAR THE PACKAGE'S COPYRIGHT HOLDER/2011 UK Citizens Online Democracy/; s/PACKAGE package/main FixMyStreet code/; s/FIRST AUTHOR , YEAR./Matthew Somerville , 2011-06-03./; s/PACKAGE VERSION/1.0\\\n\"\n\"Report-Msgid-Bugs-To: matthew@mysociety.org/; s/POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE/POT-Creation-Date: $NOW/; s/LL@li.org/team@fixmystreet.com/; s/charset=CHARSET/charset=UTF-8/; s/8bit/8bit\\\n\"\n\"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;/; " >> $TEMP mv $TEMP $PO echo "$( bin/gettext-nget-patch )" >> $PO bin/make_emptyhomes_po