Changeset 279 for trunk


Ignore:
Timestamp:
12/17/09 09:26:21 (14 years ago)
Author:
nanardon
Message:
  • add locale selection
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Epoll.pm

    r278 r279  
    4141    'Plugin::ConfigLoader' => { 
    4242        file => -f __PACKAGE__->path_to('epoll.yml') 
    43             ? __PACKAGE__->path_to('epoll.yml') 
    44             : '/etc/epoll.yml', 
     43        ? __PACKAGE__->path_to('epoll.yml') 
     44        : '/etc/epoll.yml', 
     45    }, 
     46    'Plugin::I18N' => { 
     47        maketext_options => { 
     48            Decode => 0 
     49        }, 
    4550    } 
    4651); 
  • trunk/lib/Epoll/View/TT.pm

    r277 r279  
    2929    my ($self, $c) = @_; 
    3030 
     31    my ($locale) = split(';', $c->req->header('Accept-Language')); 
     32    if (my $plocale = ($c->req->param('locale')|| $c->session->{'locale'})) { 
     33        $c->session->{'locale'} = $locale = $plocale; 
     34    } 
     35    $c->languages($locale ? [ $locale ] : ''); 
     36    $c->stash->{locale} = $locale; 
     37 
    3138    $c->stash->{Epoll}{VERSION} = $Epoll::DB::VERSION; 
    3239    Catalyst::View::TT::process($self, $c); 
  • trunk/root/templates/includes/header.tt

    r278 r279  
    2828    <p id="title"><b>Epoll:</b> [% l('Web voting system') %]</p> 
    2929    <p id="now" style="float: right">[% l('Page generated the [_1]', c.model('Vote').dbtime) | html %]</p> 
    30     <p id="menu"> 
     30        <form style="float: right"> 
     31            <select name="locale"> 
     32            <option>C</option> 
     33            [% FOREACH l = [ 'fr' ] %] 
     34            <option[% " selected" IF locale == l %]>[% l | html %]</option> 
     35            [% END %] 
     36        </select><input type="submit"> 
     37        </form> 
     38    <p id="menu" style="clear: both;"> 
    3139    <a href="[% c.uri_for('/') %]">Acceuil</a> :: 
    3240    <a href="[% c.uri_for('/newpoll') %]">Créer un nouveau vote</a> 
Note: See TracChangeset for help on using the changeset viewer.