Hello, I copied the code from admin\views\layout.html to myapp\views\default\user.html and made 2 small changes to only allow 'en' and 'pt' and to the path.
{{if hasattr(T,'get_possible_languages_info'):}} <select name="adminlanguage" onchange="var date = new Date();cookieDate=date.setTime(date.getTime()+(100*24*60*60*1000));document.cookie='adminLanguage='+this.options[this.selectedIndex].id+'; expires='+cookieDate+'; path='/user/login?_next=/';window.location.reload()"> {{for langinfo in sorted([(code,info[1]) for code, info in iteritems(T.get_possible_languages_info()) if code != 'default' and code in ['pt', 'en']]):}} <option {{=T.accepted_language==langinfo[0] and 'selected' or ''}} {{='id='+langinfo[0]}} >{{=langinfo[1]}}</option> {{pass}} </select> {{pass}} The page does not refresh and does not change language. The selection sticks. If I change the path to /, like it is in the admin\views\layout.html, the page refreshes but the selection always returns to 'en' and the page is always in 'en'. I tried this code (modified) in db.py from another article in the forum: if 'adminlanguage' in request.cookies and request.cookies['adminlanguage'] is not None: print('in cookie') T.force(request.cookies['adminlanguage'].value) else: print('force en') T.force('en') but I always get 'force en' in the console. I've tried with IE and Firefox and checked the option to allow cookies and even added the addresses of my machine (both http://192.168.255.1 and http://192.168.255.1:8000) to always allow cookies section. Nothing worked. Thanks, JM -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.