diff options
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r-- | perllib/FixMyStreet/App.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 15 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/EmptyHomes.pm | 20 |
3 files changed, 36 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm index 0c3a8d1cf..1d584accb 100644 --- a/perllib/FixMyStreet/App.pm +++ b/perllib/FixMyStreet/App.pm @@ -353,7 +353,7 @@ sub uri_for_email { my @args = @_; my $normal_uri = $c->uri_for(@_); - my $base = $c->cobrand->base_url_for_emails(); + my $base = $c->cobrand->base_url_with_lang( 1 ); my $email_uri = $base . $normal_uri->path_query; diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index daea586e4..2f0833a0a 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -137,6 +137,21 @@ sub base_url_for_emails { return $self->base_url; } +=head2 base_url_with_lang + +=cut + +sub base_url_with_lang { + my $self = shift; + my $email = shift; + + if ($email) { + return $self->base_url_for_emails; + } else { + return $self->base_url; + } +} + =head2 admin_base_url Base URL for the admin interface. diff --git a/perllib/FixMyStreet/Cobrand/EmptyHomes.pm b/perllib/FixMyStreet/Cobrand/EmptyHomes.pm index cbecb1c34..c40ea5eb7 100644 --- a/perllib/FixMyStreet/Cobrand/EmptyHomes.pm +++ b/perllib/FixMyStreet/Cobrand/EmptyHomes.pm @@ -30,6 +30,26 @@ sub area_types { return qw(DIS LBO MTD UTA LGD COI); # No CTY } + +sub base_url_with_lang { + my $self = shift; + my $email = shift; + + my $base = $self->base_url; + + if ($email) { + $base = $self->base_url_for_emails; + } + + my $lang = $mySociety::Locale::lang; + if ($lang eq 'cy') { + $base =~ s{http://}{$&cy.}; + } else { + $base =~ s{http://}{$&en.}; + } + return $base; +} + =item set_lang_and_domain LANG UNICODE Set the language and text domain for the site based on the query and host. |