diff options
author | Struan Donald <struan@exo.org.uk> | 2014-03-19 10:06:06 +0000 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2014-04-08 13:21:11 +0100 |
commit | 96a2bb583e614cdd721909ebff21f3c1522e1024 (patch) | |
tree | 4432c23921cc33d3ea44d7cdb01fee256654d1bf /bin/gettext-extract | |
parent | ea01f4ff8681284e8f5f1e45e4c6c61a14f11311 (diff) |
enable generation of cobrand specific po files
This is to stop the main FixMyStreet .po file being filled up with
strings that only apply to a single Cobrand that are not relevant to
people running their own fairly vanilla version.
Restrict the list of templates that we pull strings out of by generating
a list of all the ones in currently translated cobrands for minimal
impact. Use that to create the FixMyStreet.po file in gettext-extract.
I've left the existing cobrands in but at some point we should split
these out.
Add a specific script for generating Cobrand .po files which extracts
strings from the Cobrand's templates. This is then translated and the
translated file place in the locale/$lang/LC_MESSAGES.
The the merge_cobrand_po script is run which will create an
autoCobrand.po file which has the Cobrand strings and the FixMyStreet
strings. This is then the domain used by the Cobrand.
Any cobrand specific strings from the Perl code are still in the
main FixMyStreet .po file but there should be relatively few of them so
it's less of an issue.
Diffstat (limited to 'bin/gettext-extract')
-rwxr-xr-x | bin/gettext-extract | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/bin/gettext-extract b/bin/gettext-extract index 934bf1711..a38c17127 100755 --- a/bin/gettext-extract +++ b/bin/gettext-extract @@ -13,28 +13,19 @@ cd "$(dirname $(readlink -f $BASH_SOURCE))/.." PO=locale/FixMyStreet.po rm -f $PO +# we don't want to extract strings from all the cobrand templates so list +# the ones we care about +find templates/web/default templates/web/fixmystreet templates/web/zurich templates/web/fiksgatami templates/web/emptyhomes templates/web/fixmybarangay -name '*.html' > template_list + # Extract from Perl -xgettext.pl --gnu-gettext --verbose --output $PO --plugin perl=* --plugin tt2 --directory perllib --directory templates/web --directory db --directory bin +xgettext.pl --gnu-gettext --verbose --output $PO --plugin perl=* --plugin tt2 --directory perllib -f template_list --directory db --directory bin + +# remove temporary list of templates +rm template_list # Fix headers # no such thing as tempfile on OS X -TEMP=`tempfile 2>/dev/null || mktemp /tmp/gettext-extract.XXXXXX` -NOW=`date +"%Y-%m-%d %H:%M%z"` -# strictly POSIX sed on e.g. OS X doesn't let you used \n in replacements so we do this -nl=$'\n'; -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 <EMAIL@ADDRESS>, YEAR./Matthew Somerville <matthew@mysociety.org>, 2011-06-03./; - - s/PACKAGE VERSION/1.0\\\n\"\\$nl\"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\"\\$nl\"Plural-Forms: nplurals=2; plural=n != 1;/; -" >> $TEMP -mv $TEMP $PO +bin/update_po_header.bash $PO echo "$( bin/gettext-nget-patch )" >> $PO |