I'm using LinguaPlone
for my personal website and I have set it up using languages folder.
When I try to copy and paste an image from the en language folder into the 'fr' folder, the language is not changed. So I want to fix this behavior.
I'm trying to fix this at the moment in my own code but I just don't know why it doesn't work.
So the question is: how do I achieve this ? am I on the good way to do this ? what is missing here ?
from zope import component
from zope.globalrequest import getRequest
def updatelang(ob, event):
current = event.object
tools = component.getMultiAdapter((ob, getRequest()), name=u'plone_portal_state')
current_lang = current.getLanguage()
lang = tools.language()
if current_lang != lang:
current_object.setLanguage(lang)
ob.reindexObject(idxs=['Language'])
The setLanguage
call throws an attribute error on reference_catalog
.
Note, I'm working on Plone4.1