You are right. I guess I am having trouble myself because I *am* trying to force the language (which is something a user will not do. since they are happy with the default browser setting). And I have just found this piece of code in admin:
{{if hasattr(T,'get_possible_languages_info'):}} - {{=T('Admin language')}}</span> <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=/';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}} And the model: # set the language if 'adminLanguage' in request.cookies and not (request.cookies[ 'adminLanguage'] is None): T.force(request.cookies['adminLanguage'].value) Let me get this straight: a cookie adminLanguage is set with 100 days expiration date. This cookie is then accessible via request. Sounds simple enough, I guess I can reuse this. I do not get the <select> part, but I guess is just boilerplate to create the options and force a reload of the page when a selection is performed. On Wednesday, May 29, 2013 9:06:56 AM UTC+2, Niphlod wrote: > > ? never had issues with users .... usually they download the browser with > the language they're in. > BTW, forcing a language using a session variable is not hard at all in > web2py. > > Il giorno mercoledì 29 maggio 2013 09:00:05 UTC+2, Daniel Gonzalez ha > scritto: >> >> Hi, >> >> According to the >> documentation<http://web2py.com/books/default/chapter/29/04#Internationalization,-and-Pluralization-with-T>, >> >> the T operator works based on the Accept-Language setting. In my >> experience, this is quite cumbersome for a user to set-up (I have not even >> succeeded in setting this up in Chrome), so I would prefer to rely on >> offering the user a limited set of available languages for my web >> application, in the form of a menu, or maybe a profile setting. >> >> For users without profile (i.e. not logged in), I would like to persist >> this setting across requests. How could I do this? >> >> What are the strategies being used by others offering pages in multiple >> languages? >> >> Thanks, >> Daniel >> > -- --- 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/groups/opt_out.