aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/App.pm8
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm18
-rw-r--r--perllib/FixMyStreet/Cobrand/EmptyHomes.pm3
3 files changed, 23 insertions, 6 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index bc9bd7672..825a9f3b3 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -96,7 +96,8 @@ sub setup_cobrand {
# append the cobrand templates to the include path
$c->stash->{additional_template_paths} =
- [ $cobrand->path_to_web_templates . '' ];
+ [ $cobrand->path_to_web_templates . '' ]
+ unless $cobrand->is_default;
my $host = $c->req->uri->host;
my $lang =
@@ -104,8 +105,9 @@ sub setup_cobrand {
: $host =~ /cy/ ? 'cy'
: undef;
- # set the language and the translation file to use
- $cobrand->set_lang_and_domain( $lang, 1 );
+ # set the language and the translation file to use - store it on stash
+ my $set_lang = $cobrand->set_lang_and_domain( $lang, 1 );
+ $c->stash->{lang_code} = $set_lang;
Problems::set_site_restriction_with_cobrand_object($cobrand);
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index 608a754f7..f8ec4a319 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -40,6 +40,19 @@ sub moniker {
return lc($last_part);
}
+=head2 is_default
+
+ $bool = $cobrand->is_default();
+
+Returns true if this is the default cobrand, false otherwise.
+
+=cut
+
+sub is_default {
+ my $self = shift;
+ return $self->moniker eq 'default';
+}
+
=head2 q
$request = $cobrand->q;
@@ -140,7 +153,7 @@ sub enter_postcode_text { '' }
=head2 set_lang_and_domain
- $cobrand->set_lang_and_domain( $lang, $unicode )
+ my $set_lang = $cobrand->set_lang_and_domain( $lang, $unicode )
Set the language and domain of the site based on the cobrand and host.
@@ -148,10 +161,11 @@ Set the language and domain of the site based on the cobrand and host.
sub set_lang_and_domain {
my ( $self, $lang, $unicode ) = @_;
- mySociety::Locale::negotiate_language(
+ my $set_lang = mySociety::Locale::negotiate_language(
'en-gb,English,en_GB|nb,Norwegian,nb_NO', $lang ); # XXX Testing
mySociety::Locale::gettext_domain( 'FixMyStreet', $unicode );
mySociety::Locale::change();
+ return $set_lang;
}
=head2 alert_list_options
diff --git a/perllib/FixMyStreet/Cobrand/EmptyHomes.pm b/perllib/FixMyStreet/Cobrand/EmptyHomes.pm
index 6b907cbd0..934a9cc23 100644
--- a/perllib/FixMyStreet/Cobrand/EmptyHomes.pm
+++ b/perllib/FixMyStreet/Cobrand/EmptyHomes.pm
@@ -38,10 +38,11 @@ Set the language and text domain for the site based on the query and host.
sub set_lang_and_domain {
my ( $self, $lang, $unicode ) = @_;
- mySociety::Locale::negotiate_language(
+ my $set_lang = mySociety::Locale::negotiate_language(
'en-gb,English,en_GB|cy,Cymraeg,cy_GB', $lang );
mySociety::Locale::gettext_domain( 'FixMyStreet-EmptyHomes', $unicode );
mySociety::Locale::change();
+ return $set_lang;
}
=item site_title