Hi Guillem
This question is specific to Plone so you would
better ask
on the plone-users list. Two things that might be
worth a try:
- REQUEST/LANGUAGE
- context/portal_languages/LANGUAGE
Andreas
Sorry for posting in the wrong forum, and thanks for
the suggestions. They don't seem to work in my case,
but I guess it depends on the specific i18n product
you use...
Sometime ago I did something similar with PTS, but since
zope 2.8.x you can use five, which has an own i18n module,
I rewrote my code.
Anyway, if I'm not wrong, it is possible to get the current
language by doing:
lang = getattr(REQUEST,'language')
You may also try
lang = getattr(REQUEST,'HTTP_ACCEPT_LANGUAGE')
If not, print the REQUEST object in a template and see the
variables on it.
Another way I used it an Python Product was:
def getLanguage(context,domain=None):
"""Gets the current language of the user browser"""
#I known in the PTS API there is a better way to get this, but
#I'm not using it anymore, so I don't know where it is. You
#may trying by looking at the PTS source
TranslationService = context.Control_Panel.TranslationService
currentLanguage = TranslationService.negotiate_language(request,domain)
if currentLanguage==None:
#PlacelessTranslationService returns None
#when using wget or urllib, so, I forced
#english to be the default. Note: this was in my old PTS,
#I don't know if this is still the case
return 'en'
return return currentLanguage[0:2]
Best regards
Josef
_______________________________________________
ZPT mailing list
ZPT@zope.org
http://mail.zope.org/mailman/listinfo/zpt