translation-menu
================
::
    >>> portal = layer['portal']
    >>> from zope import component
    >>> from zope.browsermenu.interfaces import IBrowserMenu
    >>> from plone.app.testing import (
    ...     SITE_OWNER_NAME,
    ...     SITE_OWNER_PASSWORD,
    ... )
    >>> from plone.testing.z2 import Browser
    >>> browser = Browser(layer['app'])
    >>> browser.handleErrors = False
    >>> browser.addHeader('Authorization', 'Basic %s:%s' %(SITE_OWNER_NAME, SITE_OWNER_PASSWORD))
    >>> portal = layer['portal']
    >>> portal_url = portal.absolute_url()
    >>> from Products.CMFCore.utils import getToolByName
    >>> lang_tool = getToolByName(portal, 'portal_languages')
    >>> lang_tool.supported_langs = ['en', 'it', 'de']

samplecontent::

	>>> from zope.lifecycleevent import ObjectAddedEvent
	>>> from zope.event import notify
    >>> content_id = portal.invokeFactory(type_name='Document', id='sampledocument-form')
    >>> content = portal[content_id]
	>>> notify(ObjectAddedEvent(content))
    >>> import transaction
    >>> transaction.commit()

menu::

    >>> menu = component.getUtility(IBrowserMenu, name="plone_contentmenu_multilingual", context=content)

We should see our menu::

    >>> browser.open(content.absolute_url())
    >>> 'Translate' in browser.contents
    True

We should see menu entries::

    >>> 'translate_into_it' in browser.contents
    True
    >>> 'translate_into_de' in browser.contents
    True

We should not see::

    >>> 'translate_into_en' in browser.contents
    False

The menu should not appear if ITranslatable isn't provided by context ::

    >>> browser.open(portal.absolute_url() + '/folder_listing')
    >>> 'Translate' in browser.contents
    False


Translation menu for folder with default page
==============================================

samplecontent::

    >>> folder_id = portal.invokeFactory(type_name="Folder", id="folder")
    >>> folder = portal[folder_id]
	>>> notify(ObjectAddedEvent(folder))
    >>> page_id = folder.invokeFactory(type_name="Document", id="page")
    >>> page = folder[page_id]
	>>> notify(ObjectAddedEvent(page))
    >>> folder.setDefaultPage("page")
    
    >>> import transaction
    >>> transaction.commit()
    
We should see menu item sets for both folder and default page::

    >>> browser.open(folder.absolute_url())
    >>> "folder/@@create_translation" in browser.contents
    True
    >>> "page/@@create_translation" in browser.contents
    True

