Convert site to multilingual

I have a Plone 5 site, with content – folders, pages, images, custom content types (with custom views( and a few mosaic views.
All content is Dexterity

Now, we want to make the site Multilingual.

What is the best approach when installing alone.app.multilingua

Do I move all folders and content to the 'no' folder and just translate it from there?

Anything else I should think of / test before I start ?

As always make a backup before :wink:

When you install pam, the only thing that is done for you is the setup of the language folders and this happens when you configure the languages within the control panel.

From then on you have to move your content manually to the language root of choice and start translating. You can also link objects later as you need them. There also is no canonical language folder anymore, all language items are "equal".

2 Likes

There is nice documentation at https://docs.plone.org/external/plone.app.multilingual/README.html

Thanks

I'm not grasping what you mean by this.

Toolbar -> Translate -> Manage Translations

In that overview you see what's already translated or not. Use the link/unlink icon to connect the language version of your choice.

1 Like

I ran into activating plone.app.multilingual issues myself yesterday. Once you install p.a.multilingual add'on, it hooks into changes you make to the available languages in the languages control panel and tries to fix/set up things automatically.

That didn't work out for me, maybe because I had already selected 2 languages in the control panel before I installed the p.a.multilingual add'o in the site . So I removed the second language, re-added it again, added a third language to get rid of the second one I actually wanted without ending up with one language. etc. etc. But I still ended up with a FrankenLingual setup.

What I had to check/set up manually and I assume p.a.multilingual does for you if you stick to the right(tm) order, whatever that may be:

  • Unlike previous p.a.multilingual installs, access to the Plone Site Root was not automatically redirected to the preferred Language Root Folder. Turns out there is a Language Root Switcher view that should be set on the site root, you can add it manually

  • My second Language Root Folder didn't have its own language set correctly. It was also set to English (English being the first language). This impacted the language selector viewlet which didn't work. So check that all your language root folders (LRF) have the correct language after p.a.multilingual creates it.

1 Like

Getting this up because has a lot of precious informations. Maybe this should go to p.a.m. documentation?

I've also found you've to save the object again to have the pam language set, a catalog reindex is not enough. So the strategy is to walk the site, and set the language on the content. This is the browser view I've used to set 'it' on everything other than '/en' where 'en' is set:

from plone.dexterity.browser.view import DefaultView
from zope.component import getMultiAdapter
from plone.app.uuid.utils import uuidToURL
from Products.CMFPlone.interfaces import ILanguage
from zope.component.hooks import getSite
from zope.interface import alsoProvides
from plone.protect.interfaces import IDisableCSRFProtection
from zope.event import notify
from zope.lifecycleevent import modified

class FixView(DefaultView):
    """ Library forms page """

    def __init__(self, context, request):
        self.context = context
        self.request = request

    def __call__(self):
        """"""
        alsoProvides(self.request, IDisableCSRFProtection)
        portal = getSite()
        catalog = portal.portal_catalog

        brains = catalog(path='/Plone/')

        for b in brains:
            path = b.getPath()
            if '/en/' not in path:
                lang ='it'
            else:
                lang='en'
            obj = b.getObject()
            print(path, obj.Language())
            ILanguage(obj).set_language(lang)
            notify(modified(obj))
            print(path, obj.Language())
        return 'done'

(inspired by How do you use collective.lineage (for folders as subsites)? - #5 by pbauer)

This fix most of the problem when converting a site from a manual multilingual (/it, /en and language get from the path, no p.a.m) to a pam site.