diff --git a/lib/AccountManager/App.pm b/lib/AccountManager/App.pm
index 2456523c9563f4c0b3de53191cb4abe6053712eb..2838334463945e2f43559d16869634cc713e5db3 100644
--- a/lib/AccountManager/App.pm
+++ b/lib/AccountManager/App.pm
@@ -63,9 +63,21 @@ sub new {
     }
 
     $self->{logger} = Log::Any->get_logger();
-    $self->{lh}     = AccountManager::L10N->get_handle();
+    $self->{cgi}    = CGI->new();
 
-    $self->{cgi} = CGI->new();
+    my $lang =
+        $self->{cgi}->param('lang') ||
+        $self->{cgi}->cookie('lang');
+    $self->{lh} = AccountManager::L10N->get_handle($lang ? $lang: ());
+    if (!$self->{lh}) {
+        $self->{logger}->fatal("Unable to get suitable language handle");
+        $self->respond(
+            template => 'errors.tt2.html',
+            data     => {
+                errors  => [ 'internal' ]
+            }
+        );
+    }
 
     if (!$self->{configuration}->{mailer}) {
         $self->{logger}->fatal(
@@ -194,9 +206,16 @@ sub respond {
 
     binmode(STDOUT, ":utf8");
 
+    my $cookie = $self->{cgi}->cookie(
+        -name    => 'lang',
+        -value   => $self->{lh}->language_tag(),
+        -expires => undef,
+    );
+
     print $self->{cgi}->header(
         -type    => 'text/html',
-        -charset => 'utf8'
+        -charset => 'utf8',
+        -cookie  => [ $cookie ]
     );
 
     unless ($tt2->process($in{template}, $in{data}, \*STDOUT)) {
@@ -228,6 +247,7 @@ sub req_select_federation {
     $self->respond(
         template => 'select_federation.tt2.html',
         data     => {
+            action      => 'select_federation',
             federations => \@federations
         }
     );
@@ -279,6 +299,7 @@ sub req_select_sp {
     $self->respond(
         template => 'select_sp.tt2.html',
         data     => {
+            action     => 'select_sp',
             metadata   => $metadata->parse(type => 'sp'),
             federation => $federation,
         }
@@ -407,8 +428,10 @@ sub req_select_email {
     $self->respond(
         template => 'select_email.tt2.html',
         data     => {
+            action     => 'select_email',
             federation => $federation,
             sp         => $sp,
+            entityid   => $sp->entityid(),
         }
     );
 }
@@ -608,6 +631,7 @@ sub req_complete_challenge {
     $self->respond(
         template  => 'complete_challenge.tt2.html',
         data     => {
+            action     => 'complete_challenge',
             federation => $federation,
             entityid   => $self->{in}->{entityid},
             email      => $self->{in}->{email},
@@ -787,8 +811,10 @@ sub req_create_accounts {
     $self->respond(
         template => 'create_accounts.tt2.html',
         data     => {
+            action   => 'create_accounts',
             accounts => \@accounts,
             entityid => $self->{in}->{entityid},
+            email    => $self->{in}->{email},
             key      => $key,
             token    => $download_token->token(),
             days     => $validity_period,
@@ -929,6 +955,9 @@ sub req_home {
 
     $self->respond(
         template => 'home.tt2.html',
+        data => {
+            action => 'home'
+        }
     );
 }