On 12-09-2005, at 9:49, Lalo Martins wrote:

- We have a component called "translation service", which loads the
message catalogs and indexes them in memory.

My i18n implementation currently load translations when a request is created (using LocaleMiddleware) and store translation object inside the request using (somewhat modified) gettext translation objects. Also I modified DjangoContext to include i18n object and some other info (available locales and current locale).

- The templates have i18n markup; so the strings are translated when
the template is being rendered.

Similarly, I created {% i18n <gettext function>('') %} tag for that. I deliberately choose this syntax to enable using of xgetext for extracting messages (with lang set to python) and to decrease number of new tags added to template language.

- I originally implemented PlacelessTranslationService to choose a
language based on the HTTP header, overridable by a cookie. Alas, that
didn't work out so well :-( turns out most people don't even know they
can set up language preferences in their browser.  The more recent
versions of plone are migrating to a click-the-flag system (which
essentialy just sets the aforementioned cookie).

Sadly, that's true. Currently I'm trying to get language from HTTP header, then from session and at last from cookie. Additionally I'm implemented a view to manually select language (with a customizable URI, i.e. I'm currently using r'/lang/(?P<locale>.*?)/ $') and storing selected language in the session (if available) or the cookie.

I'm currently finishing my first site with django and my i18n implementation (beta version of the site will be probably published this week), currently without translated admin interface (I don't have time to do that for now - deadline is closing :( ), but all other parts of the site are fully i18n-ized.

---
Nebojša Đorđević - nesh
Studio Quattro - Niš - SCG

http://djnesh.blogspot.com/  |  http://djnesh-django.blogspot.com/
Registered Linux User 282159 [http://counter.li.org]



Reply via email to