diff options
author | louise <louise> | 2009-09-02 08:55:59 +0000 |
---|---|---|
committer | louise <louise> | 2009-09-02 08:55:59 +0000 |
commit | 3f96fbc0a8cfbabf7eeeb447aff60c64144e0c54 (patch) | |
tree | ef8c4bfa06e8758e367158911b2e446a383d2b16 | |
parent | e24c517859bce932857ba50d5b685fe4723b56d5 (diff) |
Making lang the param for set_lang_and_domain
-rw-r--r-- | perllib/Cobrand.pm | 8 | ||||
-rw-r--r-- | perllib/Cobrands/Emptyhomes/Util.pm | 11 | ||||
-rw-r--r-- | perllib/Page.pm | 7 |
3 files changed, 13 insertions, 13 deletions
diff --git a/perllib/Cobrand.pm b/perllib/Cobrand.pm index b30b5fe48..4e3638881 100644 --- a/perllib/Cobrand.pm +++ b/perllib/Cobrand.pm @@ -7,7 +7,7 @@ # Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved. # Email: louise@mysociety.org. WWW: http://www.mysociety.org # -# $Id: Cobrand.pm,v 1.7 2009-09-02 08:32:00 louise Exp $ +# $Id: Cobrand.pm,v 1.8 2009-09-02 08:55:59 louise Exp $ package Cobrand; use strict; @@ -74,15 +74,15 @@ sub set_site_restriction{ } -=item set_lang_and_domain COBRAND HOST +=item set_lang_and_domain COBRAND LANG Set the language and domain of the site based on the cobrand and host =cut sub set_lang_and_domain{ - my ($cobrand, $host) = @_; + my ($cobrand, $lang) = @_; my $handle = cobrand_handle($cobrand); if ($handle != 0){ - $handle->set_lang_and_domain($host); + $handle->set_lang_and_domain($lang); } } diff --git a/perllib/Cobrands/Emptyhomes/Util.pm b/perllib/Cobrands/Emptyhomes/Util.pm index 32fb86333..560d85ceb 100644 --- a/perllib/Cobrands/Emptyhomes/Util.pm +++ b/perllib/Cobrands/Emptyhomes/Util.pm @@ -7,7 +7,7 @@ # Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved. # Email: louise@mysociety.org. WWW: http://www.mysociety.org # -# $Id: Util.pm,v 1.2 2009-09-02 08:31:26 louise Exp $ +# $Id: Util.pm,v 1.3 2009-09-02 08:55:59 louise Exp $ package Cobrands::Emptyhomes::Util; use Standard; @@ -57,17 +57,14 @@ sub page{ } } -=item set_lang_and_domain HOST +=item set_lang_and_domain Q HOST -Set the language and text domain for the site based on the host. +Set the language and text domain for the site based on the query and host. =cut sub set_lang_and_domain{ - my ($self, $host) = @_; - my $lang; - $lang = 'cy' if $host =~ /cy/; - $lang = 'en-gb' if $host =~ /^en\./; + my ($self, $lang) = @_; mySociety::Locale::negotiate_language('en-gb,English,en_GB|cy,Cymraeg,cy_GB', $lang); mySociety::Locale::gettext_domain('FixMyStreet-EmptyHomes'); mySociety::Locale::change(); diff --git a/perllib/Page.pm b/perllib/Page.pm index 65b6abc9b..8635e2002 100644 --- a/perllib/Page.pm +++ b/perllib/Page.pm @@ -6,7 +6,7 @@ # Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: Page.pm,v 1.167 2009-09-02 08:35:25 louise Exp $ +# $Id: Page.pm,v 1.168 2009-09-02 08:55:59 louise Exp $ # package Page; @@ -105,7 +105,10 @@ sub microsite { } if ($q->{site} ne 'fixmystreet') { - Cobrand::set_lang_and_domain($q->{site}, $host); + my $lang = 'en-gb'; + $lang = 'cy' if $host =~ /cy/; + $lang = 'en-gb' if $host =~ /^en\./; + Cobrand::set_lang_and_domain($q->{site}, $lang); } else { mySociety::Locale::negotiate_language('en-gb,English,en_GB|nb,Norwegian,nb_NO'); # XXX Testing mySociety::Locale::gettext_domain('FixMyStreet'); |