the catalog-patch
=================
::
    >>> from Products.CMFCore.utils import getToolByName
    >>> portal = layer['portal']
    >>> from plone.multilingual.interfaces import ILanguage
    >>> from zope.lifecycleevent import ObjectAddedEvent
    >>> from zope.event import notify
    >>> from plone.multilingual.interfaces import LANGUAGE_INDEPENDENT

samplecontent::

    >>> documents = []
    >>> for i in range(0,3):
    ...     content_id = portal.invokeFactory(type_name='Document', id='sampledocument_%d' % i)
    ...     content = portal[content_id]
    ...     notify(ObjectAddedEvent(content))
    ...     documents.append(content)
    >>> import transaction
    >>> transaction.commit()

    >>> for cnt,lang in enumerate(['', 'it', 'en']):
    ...     ILanguage(documents[cnt]).set_language(lang)
    ...     documents[cnt].reindexObject()

    >>> catalog = getToolByName(layer['portal'], 'portal_catalog')
    >>> request = layer['request']

query with all::

    >>> kw = {'Language': 'all'}
    >>> used_langs = [x.Language for x in catalog.searchResults(request,**kw)]
    >>> LANGUAGE_INDEPENDENT in used_langs
    True
    >>> 'it' in used_langs
    True
    >>> 'en' in used_langs
    True

query for language-independent content::

    >>> kw = {'Language': LANGUAGE_INDEPENDENT}
    >>> lang_independent = [x.Language for x in catalog.searchResults(request,**kw)]
    >>> LANGUAGE_INDEPENDENT in lang_independent
    True
    >>> len(lang_independent) == 1
    True

query for a language::

    >>> kw = {'Language': 'it'}
    >>> [x.Language for x in catalog.searchResults(request,**kw)]
    ['it']

query without language set (result should contain default_language and independent content)::

    >>> used_langs = [x.Language for x in catalog.searchResults(request)]
    >>> LANGUAGE_INDEPENDENT in used_langs
    True
    >>> 'en' in used_langs
    True


