[Jifty-commit] r4262 - in jifty/trunk/lib/Jifty: .
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri Oct 19 12:21:59 EDT 2007
Author: clkao
Date: Fri Oct 19 12:21:59 2007
New Revision: 4262
Modified:
jifty/trunk/lib/Jifty/Handler.pm
jifty/trunk/lib/Jifty/I18N.pm
jifty/trunk/lib/Jifty/Plugin/SkeletonApp/Dispatcher.pm
Log:
* Delay i18n handle init until we have session.
* SkeletonApp dispatcher rule to set language in session.
Modified: jifty/trunk/lib/Jifty/Handler.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Handler.pm (original)
+++ jifty/trunk/lib/Jifty/Handler.pm Fri Oct 19 12:21:59 2007
@@ -208,13 +208,12 @@
Jifty::I18N->refresh;
}
- Jifty::I18N->get_language_handle;
-
$self->cgi( $args{cgi} );
$self->apache( HTML::Mason::FakeApache->new( cgi => $self->cgi ) );
Jifty->web->request( Jifty::Request->new()->fill( $self->cgi ) );
Jifty->web->response( Jifty::Response->new );
+
Jifty->api->reset;
for ( Jifty->plugins ) {
$_->new_request;
@@ -222,6 +221,8 @@
Jifty->log->debug( "Received " . $self->apache->method . " request for " . Jifty->web->request->path );
Jifty->web->setup_session;
+ Jifty::I18N->get_language_handle;
+
# Return from the continuation if need be
Jifty->web->request->return_from_continuation;
Jifty->web->session->set_cookie;
Modified: jifty/trunk/lib/Jifty/I18N.pm
==============================================================================
--- jifty/trunk/lib/Jifty/I18N.pm (original)
+++ jifty/trunk/lib/Jifty/I18N.pm Fri Oct 19 12:21:59 2007
@@ -138,8 +138,10 @@
=cut
sub get_language_handle {
+ # XXX: subrequest should not need to get_handle again.
my $self = shift;
- $$DynamicLH = $self->get_handle() if $DynamicLH;
+ my $lang = Jifty->web->session->get('jifty_lang');
+ $$DynamicLH = $self->get_handle($lang ? $lang : ()) if $DynamicLH;
}
=head2 refresh
Modified: jifty/trunk/lib/Jifty/Plugin/SkeletonApp/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/SkeletonApp/Dispatcher.pm (original)
+++ jifty/trunk/lib/Jifty/Plugin/SkeletonApp/Dispatcher.pm Fri Oct 19 12:21:59 2007
@@ -37,5 +37,10 @@
return ();
};
+before '**' => run {
+ if (my $lang = Jifty->web->request->arguments->{_jifty_lang}) {
+ Jifty->web->session->set(jifty_lang => $lang);
+ }
+};
1;
More information about the Jifty-commit
mailing list