I think I should clarify something, it's not the language of the site 
itself, it's about what content is available for the users to 
create/read/update/delete. For example, the base records are English, now 
we need a Swedish user to translate those (ie create Swedish records). This 
user should only be able to read English and create/update Swedish.

I like to use existing code as much as possible but I think I'm stretching 
it here.

Op zondag 14 april 2013 15:22:04 UTC+2 schreef 黄祥 het volgende:
>
> why not create the language selector like in admin page? store the 
> language value in cookie
>
> something like:
> *db.py*
> *# set the language
> *
> *if 'language' in request.cookies and not (request.cookies['language'] is 
> None):*
> *    T.force(request.cookies['language'].value)*
>
> *default/layout.html*
>     <!-- Footer ================================================== -->
>     <div class="row">
>         <footer class="footer span12" id="footer">
>             <div class="footer-content">
>                 {{block footer}} <!-- this is default footer -->
>                 <div class="copyright pull-left"></div>
>                 <div id="poweredBy" class="pull-right"></div>
>                 <center><span>{{=T('Copyright')}} &#169; 
> {{=request.now.year}}
> *                {{if hasattr(T,'get_possible_languages_info'):}}*
> *                - </span>*
> *                <select name="language" onchange="var date = new 
> Date();cookieDate=date.setTime(date.getTime()+(100*24*60*60*1000));document.cookie='language='+this.options[this.selectedIndex].id+';
>  
> expires='+cookieDate+'; path=/';window.location.reload()">*
> *                    {{for langinfo in sorted([(code,info[1]) for 
> code,info in T.get_possible_languages_info().iteritems() if code != 
> 'default']):}}*
> *                    <option {{=T.accepted_language==langinfo[0] and 
> 'selected' or ''}} {{='id='+langinfo[0]}} >{{=langinfo[1]}}</option>*
> *                    {{pass}}*
> *                </select>*
>                 {{else:}}
>                 </span>{{pass}}</center>
>                 {{end}}
>             </div>
>         </footer>
>     </div>
>
> hope this can help
>
> best regards
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to