i have a site in Plone 5.2,
the site already
has at root /en and /cs directory,
then we activated plone.app.multilingual 5.6.4 addon via /prefs_install_products_form
for Page content type i set 2 behaviours via /dexterity-types/Document/@@behaviors :
Blocks
Enables Volto Blocks support
Multilingual Support (this was already set)
Make this content type multilingual aware
but for this Page ct, we have only 2 choices from "Translate" on left menu!
could you please give idea?
Many thanks for your time.
when you've already existing folders, this is what I had to do (slightly modified, so check it before using it), using a browserview:
class FixView(DefaultView):
""" Setup and fix language on the site """
def __init__(self, context, request):
self.context = context
self.request = request
def __call__(self):
""""""
alsoProvides(self.request, IDisableCSRFProtection)
portal = api.portal.get()
# setup language root folders
alsoProvides(portal.it, ILanguageRootFolder)
alsoProvides(portal.en, ILanguageRootFolder)
# handle reindex
notify(modified(portal.it))
notify(modified(portal.en))
# link it (/it) and en (/en) folders
canonical = ITranslationManager(portal.it)
canonical_en = ITranslationManager(portal.en)
try:
canonical_en.remove_translation('it')
canonical_en.remove_translation('en')
except:
pass
canonical.register_translation('en', portal.en)
try:
canonical.register_translation('it', portal.it)
except:
pass
# back registration can help?
canonical_en.register_translation('it', portal.it)
canonical_en.register_translation('en', portal.en)
ILanguage(portal.it).set_language('it')
ILanguage(portal.en).set_language('en')
# reindex already existing objects
catalog = api.portal.get_tool('portal_catalog')
# set language on the content, my lang policy
for b in catalog():
path = b.getPath()
obj = b.getObject()
# improve this check
if 'en' in path.split('/'):
ILanguage(obj).set_language('en')
if 'it' in path.split('/'):
ILanguage(obj).set_language('it')
notify(modified(obj))
# print something
print(path, obj.Language())
There's also a browser view to migrate folders to language root folders:
An alternative approach (and cleaner), if you don't have too much content, is to rename existing regular folders /en and /cs, save multilingual config in the control panel (this creates /en and /cs language root folders) and move back content to /en and /cs from the renamed regular folders. Then it can depend on the policy. If your policy is that /en is English and /cs is BCMS, then you can skip setting language on every object.