aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorDave Whiteland <dave@mysociety.org>2012-10-03 17:47:25 +0100
committerDave Whiteland <dave@mysociety.org>2012-10-03 17:47:25 +0100
commit272dba7ce6d59d81b52579dd4c5fc7d65e9bec20 (patch)
treecabbefec7823061781050ffb002a38ce53d68f56 /bin
parent39c1b648b30e67ceb8912a35b386eb4ee23857b8 (diff)
parentf16a3e96b65394089d10c46c1d67cf82c67e72dd (diff)
Merge branch 'fmb-read-only'
Conflicts: db/schema.sql perllib/FixMyStreet/DB/Result/Contact.pm perllib/FixMyStreet/DB/Result/Problem.pm
Diffstat (limited to 'bin')
-rwxr-xr-xbin/gettext-extract12
-rwxr-xr-xbin/gettext-nget-patch1
-rwxr-xr-xbin/make_css12
-rwxr-xr-xbin/make_po (renamed from bin/make_emptyhomes_po)18
4 files changed, 25 insertions, 18 deletions
diff --git a/bin/gettext-extract b/bin/gettext-extract
index 55623e86c..6bae8aa36 100755
--- a/bin/gettext-extract
+++ b/bin/gettext-extract
@@ -31,23 +31,27 @@ rm -f $PO
xgettext.pl --gnu-gettext --verbose --output $PO --plugin perl=* --plugin tt2 --directory perllib --directory templates/web --directory db --directory bin
# Fix headers
-TEMP=`tempfile`
+# 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\"\n\"Report-Msgid-Bugs-To: matthew@mysociety.org/;
+ 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\"\n\"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;/;
+ s/8bit/8bit\\\n\"\\$nl\"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;/;
" >> $TEMP
mv $TEMP $PO
echo "$( bin/gettext-nget-patch )" >> $PO
-bin/make_emptyhomes_po
+bin/make_po FixMyStreet-EmptyHomes
+bin/make_po FixMyBarangay
diff --git a/bin/gettext-nget-patch b/bin/gettext-nget-patch
index 223bcc816..eadc46d0e 100755
--- a/bin/gettext-nget-patch
+++ b/bin/gettext-nget-patch
@@ -9,6 +9,7 @@ my %out;
find( sub {
next unless -f;
+ next if $File::Find::name =~ /ttc$/;
open (FP, $_) or die $!;
while (<FP>) {
next unless /nget/;
diff --git a/bin/make_css b/bin/make_css
index 9d033b5dc..175440bb4 100755
--- a/bin/make_css
+++ b/bin/make_css
@@ -14,14 +14,14 @@
DIRECTORY=$(cd `dirname $0`/../web && pwd)
# FixMyStreet uses compass
-compass compile --output-style compressed $DIRECTORY/cobrands/fixmystreet
-compass compile --output-style compressed $DIRECTORY/cobrands/bromley
-compass compile --output-style compressed $DIRECTORY/cobrands/barnet
-compass compile --output-style compressed $DIRECTORY/cobrands/zurich
-compass compile --output-style compressed $DIRECTORY/cobrands/default
+NEWSTYLE="fixmystreet bromley fixmybarangay barnet zurich default"
+NEWSTYLE_REGEX=${NEWSTYLE// /\\|}
+for site in $NEWSTYLE; do
+ compass compile --output-style compressed $DIRECTORY/cobrands/$site
+done
# The rest are plain sass
-for scss in `find $DIRECTORY -name "*.scss" -exec dirname {} \; | uniq | grep -v "cobrands/\(fixmystreet\|bromley\|barnet\|default\|zurich\)"`
+for scss in `find $DIRECTORY -name "*.scss" -exec dirname {} \; | uniq | grep -v "cobrands/\($NEWSTYLE_REGEX\)"`
do
sass --scss --update --style compressed $scss
done
diff --git a/bin/make_emptyhomes_po b/bin/make_po
index 10e840599..76dc4566b 100755
--- a/bin/make_emptyhomes_po
+++ b/bin/make_po
@@ -1,8 +1,8 @@
#!/usr/bin/perl -w
use strict;
-# Generates EmptyHomes version of .po file, which is a translation
-# into a language the same as English, only "problem" becomes "empty property".
+# Generates a version of .po file, which is a translation
+# into a language the same as English, with replacement as specified in PoChange
use POSIX;
use FindBin;
@@ -13,14 +13,16 @@ chdir("$FindBin::Bin/../locale");
mkdir("en_GB.UTF-8");
mkdir("en_GB.UTF-8/LC_MESSAGES");
+my $pofile = shift;
+
open(MAINPO, "FixMyStreet.po") or die "";
-open(EHAPO, ">FixMyStreet-EmptyHomes.po") or die "";
-open(NEWPO, ">en_GB.UTF-8/LC_MESSAGES/FixMyStreet-EmptyHomes.po") or die "";
+open(EHAPO, ">$pofile.po") or die "";
+open(NEWPO, ">en_GB.UTF-8/LC_MESSAGES/$pofile.po") or die "";
-print NEWPO "# AUTOMATICALLY GENERATED by make_emptyhomes_po, do not edit\n";
+print NEWPO "# AUTOMATICALLY GENERATED by make_po, do not edit\n";
print NEWPO "#\n";
-print EHAPO "# AUTOMATICALLY GENERATED by make_emptyhomes_po, do not edit\n";
+print EHAPO "# AUTOMATICALLY GENERATED by make_po, do not edit\n";
print EHAPO "#\n";
my $buffer = "";
@@ -30,7 +32,7 @@ while(<MAINPO>) {
s/#, fuzzy/#/;
}
if (m/"Last-Translator: FULL NAME/) {
- $_ = '"Last-Translator: mysociety/bin/make_emptyhomes_po\\n"'."\n";
+ $_ = '"Last-Translator: mysociety/bin/make_po\\n"'."\n";
}
if (m/"PO-Revision-Date: YEAR-MO-DA/) {
my $time = POSIX::strftime("%Y-%m-%d %H:%M%z", localtime(time()));
@@ -56,7 +58,7 @@ while(<MAINPO>) {
} elsif ($start && (m/^msgstr ""/ || m/^msgstr\[0\] ""/)) {
# start of translated text - translate English into Empty Homes language
- $buffer = PoChange::fixmystreet_to_reportemptyhomes($buffer);
+ $buffer = PoChange::translate($pofile, $buffer);
print EHAPO $buffer;