> because you have to reload your object before. the correct language is 
> loaded with the 'find', and with the access reader method.

Thank you for answering. I guess the question was more a 'why' than a 
'how' question. I really don't see why we would put this limitation 
forward and not have a 'french instance' always return 'french data' and 
an 'english instance' always return 'english data'. More localized 
language context, instead of it being always a global variable.

But since I have asked this question, I have used globalize_extension 
and am quite happy with the resulting code. ie:

   @page.switch_language(base_language.code) { @page.title }

Which is more or less clean. Globalize Extension seems to support these 
local context switches I was looking for, not requiring me to

   # change locale
   # read the value (that I have already in memory, but can't access 
because of bad GLOBAL locale
   # change locale back

I profoundly dislike this kind of procedural style. Besides, it just 
screams 'non thread safe' and 'race condition' - implemented as a global 
variable that is.

So there I went and basically answered my own question - that is 
something of a bad habit. ;)

best greetings,
kaspar

_______________________________________________
Railsi18n-discussion mailing list
Railsi18n-discussion@rubyforge.org
http://rubyforge.org/mailman/listinfo/railsi18n-discussion

Reply via email to