Il giorno mar, 15/12/2009 alle 23.11 -0800, Yarko Tymciurak ha scritto: > You are not wrong - it should be exactly as this - and even more, you > should not need it.py in the case when T.current_languages is 'it' ---
Ok, this is what I was expecting > What you are saying is that when the accept language (that is, the > requested translation) does not exist, or not specified by the > client / browser, then web2py will serve in the language of the > source (the string arguments to T()). This is also true. Perfect > Now with this understanding, you should be able to keep your solution > much simpler than you originally posted. Let us know how it goes. Ok, I put a script in models which set the T.current_languages as you said. I removed the it.py / it-it.py (i set the default, so it.py is no longer needed) and I put en.py in languages/ I made 2 test with Mozilla Firefox setting in preferences the accepted-language: 1) When I set it as accept-language (no other language accepted) all work properly 2) When i set en as accepted-language (no other language accepted) the content is served in italian. To avoid this behaviour I have to explicit call T.force(lang) on each controller where lang is taken from request.env.accepted-language At this point I made another test: I branch from launchpad a clean version of web2py (rev 1458), put my app in applications and in languages i put ONLY a file called it.py I'm trying to emulate the natural behaviour that you can see, as I think you made your tests having sentences in english and trying to translate them in other languages The results are as expected, when I request the default language (in this new case 'en') keys are served, when I request the specific language I get the values from the dict in it.py So I think there are two possibuilities 1) I'm making some mistake 2) There rea some problems when default is different from en I found my solution forcing the accept language with T.force, but I think this is a trick and not the right way. Thank you for your support Regards Andrea -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.

