[Rt-commit] rt branch, 4.0/i18n-footer, created. rt-4.0.0rc6-138-gf614c32

Alex Vandiver alexmv at bestpractical.com
Mon Mar 21 15:01:35 EDT 2011


The branch, 4.0/i18n-footer has been created
        at  f614c328536ca4e5ad4ff2c75670ef82d8fb57eb (commit)

- Log -----------------------------------------------------------------
commit f614c328536ca4e5ad4ff2c75670ef82d8fb57eb
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jan 3 16:34:21 2011 -0500

    Ensure the footer is localized correctly
    
    The autohandler runs outside of our 'local *session' now, which means
    it has no information about the user's preferred language.  Move the
    call for the footer into the handler.

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index a2527c3..68f07bf 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -274,6 +274,8 @@ sub HandleRequest {
 
     # Process per-page final cleanup callbacks
     $HTML::Mason::Commands::m->callback( %$ARGS, CallbackName => 'Final', CallbackPage => '/autohandler' );
+
+    $HTML::Mason::Commands::m->comp( '/Elements/Footer', %$ARGS );
 }
 
 sub _ForceLogout {
diff --git a/share/html/autohandler b/share/html/autohandler
index f9314a9..3157e4a 100755
--- a/share/html/autohandler
+++ b/share/html/autohandler
@@ -51,8 +51,6 @@ use RT::Util;
 $m->callback( ARGSRef => \%ARGS, CallbackName => 'Init', CallbackPage => '/autohandler' );
 
 RT::Interface::Web::HandleRequest(\%ARGS);
-
-$m->comp( '/Elements/Footer', %ARGS );
 </%INIT>
 <%ARGS>
 $user => undef
diff --git a/t/i18n/footer.t b/t/i18n/footer.t
new file mode 100644
index 0000000..e0d0905
--- /dev/null
+++ b/t/i18n/footer.t
@@ -0,0 +1,29 @@
+#!/usr/bin/perl -w
+use strict;
+use warnings;
+
+use RT::Test;
+
+{
+    my $chinese = RT::User->new(RT->SystemUser);
+    $chinese->LoadOrCreateByEmail('chinese at example.com');
+    $chinese->SetName('chinese');
+    $chinese->SetLang('zh_tw');
+    $chinese->SetPrivileged(1);
+    $chinese->SetPassword('password');
+    $chinese->PrincipalObj->GrantRight(Right => 'SuperUser');
+}
+
+my ($baseurl, $m) = RT::Test->started_ok;
+$m->login( root => "password" );
+$m->content_contains('Copyright','Has english coypright');
+$m->get_ok( "/NoAuth/Logout.html" );
+
+$m->login( chinese => "password" );
+$m->content_lacks('Copyright','Lacks english copyright');
+$m->get_ok( "/NoAuth/Logout.html" ); # ->logout fails because it's translated
+
+$m->login( root => "password" );
+$m->content_contains('Copyright','Still has english copyright');
+
+undef $m;

-----------------------------------------------------------------------


More information about the Rt-commit mailing list