Make AT Content Type untranslatable with Products.LinguaPlone Installed
Purpose
Products.LinguaPlone is one of the best packages for multilingual Plone sites. However, there are use cases where you have content types that are not necessarily translatable or translatability is not desirable. ITranslatable interface is the key interface for this translatablity. Let's get rid of this interface!
Prerequisites
Products.LinguaPlone needs to be installed. This product belongs in the "magical Products namespace" and can be placed directly in your buildout's Products folder, or installed as any other eggs following the instructions of the Managing projects with buildout - Installing a third party product tutorial.
You need to be familiar with AT Content Type creation. See the Archetypes Developer Manual for more info about this topic.
Step by step
Now, as an example, we want to create a MyContentType class inherited from ATFolder. ATContentTypes types are marked with this marking interface upon the installation of LinguaPlone, so if you inherit from any of these types you'll have to remove the interface manually. But please note that this little hack is not neccessary if you inherit directly from Archetypes base classes like BaseContent or BaseFolder.
The two lines within the MyContentType class (in bold) are key lines.
...
from zope.interface import implementedBy, implementsOnly
from Products.ATContentTypes.content import folder
from plone.locking.interfaces import ITTWLockable
from my.package.intefaces import IMyContentType
...
class MyContentType(ATFolder):
interfaces = [i for i in list(implementedBy(folder.ATFolder)) if i.__name__ != 'ITranslatable']
implementsOnly(IMyContentType, ITTWLockable, interfaces)
...
Explanation
list(implementedBy(folder.ATFolder))gives you a list of implemented interfaces of ATFolder.- The
implementsOnlymethod implements only those values given. ITTWLockable is implemented here bacause this content type is lockable through the web. Add more interfaces for your need, adding more interfaces or lists of interfaces as arguments for this method.
This example will hopefully help you apply for similar use cases.
