Hi Amit, Malcolm We're about to build a site that needs english/welsh transation.
Does django.utils.translation.activate() translate from one Language to another without having to have both languages as text in a database? On the fly I guess I mean. vander. On 11/07/07, Amit Ramon <[EMAIL PROTECTED]> wrote: > > > Thanks, Malcolm. It works like a magic :) Just a small correction: it's > utils, > not util: > django.utils.translation.activate() > > I think I'll now see how to I can write a middleware, so I won't have to > call > this in each and every view. > > All the best, > > Amit > > > > The problem I'm facing is how to set the django's system language when > > > accessing a page via a url - by this I mean, for example, how to get > string > > > translation (e.g., using the templates "trans" thing). For example, > when > > > using a "/en/..." url I want to explicitly, in code, set the language > to > > > English, and when using a "/he/..." url I want to be able to set the > language > > > to Hebrew, and get strings translated. > > > > Look at django.util.translation.activate(). You pass it the language > > code you want to be in effect. So just call that early enough in the > > view processing and you should be fine. You could even write your own > > middleware to set this automatically (base it off the LocaleMiddleware > > if you want some hints). > > > > Regards, > > Malcolm > > > > -- > > Works better when plugged in. > > http://www.pointy-stick.com/blog/ > > > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django 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/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

