I don't see your point. Why add it to so many models. What will this accomplish excactly? An example would be helpful.
This is what I don't get > My idea is that a user should see every piece of content in the > language he has chosen. regards jak4 On Feb 5, 5:19 pm, Alejandro <[email protected]> wrote: > I'm just doing this. I added the localte to the models > user,post,forum,activity and clipping. I also added the locale to the > session. > My idea is that a user should see every piece of content in the > language he has chosen. > The problem is getting the locale that lives in the session from the > models when creating them. Also when finding them, because I wanted to > override the find method of those entities to include the locale in > every find invocation, to do that I used this: > > def self.find(*args) > with_scope(:find=>{ :conditions=>"posts.language='# > {UserInfo.current_locale}'" }) do > super(*args) > end > end > > I know I could just use the controllers to pass the locale, but I > would have to look for every invocation to find, create and others and > pass the locale. I prefer doing this in a more generic way. > > The workaround I found is creating a module (UserInfo) that stores the > locale in the current thread: > > module UserInfo > def self.current_locale > Thread.current[:locale] > end > > def self.current_locale=(locale) > Thread.current[:locale] = locale > end > end > > the thing with this is that I need a web server that uses the same > thread to handle all invocations of a user during his session. > I've tried this solution with WEBrick and it works, but in production > I use FASTCGI and I couldn't find any information of how it handles > the session. > > Any help will be appreciated. > > On Jan 21, 3:16 pm, Bruno Bornsztein <[email protected]> > wrote: > > > No, there isn't. You'd have to add it yourself, either by adding a locale > > column to user, or storing the users locale in the session. > > > On Wed, Jan 21, 2009 at 9:37 AM, jak4 <[email protected]> wrote: > > > > Hi, > > > > is there already an mechanism to switch the language on-the-fly? Such > > > as that the user can change his prefered language and doesn't need to > > > logout/login again to see the new language? > > > > Best regards > > > Johannes > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CommunityEngine" 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/communityengine?hl=en -~----------~----~----~----~------~----~------~--~---
