Changeset 311


Ignore:
Timestamp:
05/22/10 18:37:06 (14 years ago)
Author:
nanardon
Message:
  • add I18N support in mail like the html one
Location:
trunk
Files:
1 added
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/lib/Epoll/View/Mail.pm

    r242 r311  
    1111    INCLUDE_PATH => Epoll->path_to( 'root', 'mail' ), 
    1212    PLUGIN_BASE => 'Epoll::Template::Plugin', 
     13    PRE_PROCESS => [ 'includes/loc.tt', ], 
    1314); 
    1415 
     
    2526sub render { 
    2627    my ($self, $c, $template, $args) = @_; 
     28 
     29    my ($locale) = split(';', $c->req->header('Accept-Language') || ''); 
     30    if (my $plocale = ($c->req->param('locale')|| $c->session->{'locale'})) { 
     31        $c->session->{'locale'} = $locale = $plocale; 
     32    } 
     33    $c->languages($locale ? [ $locale ] : ''); 
     34    $c->stash->{locale} = $locale; 
    2735 
    2836    $ENV{MAILADDRESS} = $args->{From}; 
Note: See TracChangeset for help on using the changeset viewer.