Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Using static feature with different language through DDG_LOCALE env v…

…ariable
  • Loading branch information...
commit 22e34a750f52fc0bd0186763339d6e8ce8c0ef58 1 parent 38479a3
@Getty Getty authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/App/DuckPAN/WebStatic.pm
View
4 lib/App/DuckPAN/WebStatic.pm
@@ -67,10 +67,12 @@ sub request {
my $response = Plack::Response->new(200);
my $body;
+ my $locale = defined $ENV{DDG_LOCALE} ? $ENV{DDG_LOCALE} : 'en_US';
+
my $site = $self->_ports->{$request->port};
if ($site->{urls}->{$request->request_uri}) {
- $body = io($site->{urls}->{$request->request_uri}->{'en_US'})->slurp;
+ $body = io($site->{urls}->{$request->request_uri}->{$locale})->slurp;
$response->code("200");
$response->content_type('text/html');
} else {
Please sign in to comment.
Something went wrong with that request. Please try again.