Properly delete a language folder

What is the proper way to delete a language folder that was previously added but is no longer wanted? The language has been removed from the control panel but the language folder still exists (as expected). Since the language folder has a shared media folder, new items added to the media folder of other languages will be "copied" as well. When using folder_contents view to attempt a delete, I get a warning that there are links that will break.

This is on Plone 5.1.4 with PAM 5.2.3

Hi Holden :slight_smile:

Have you verified this behaviour? (Does it actually do this?)

Can you figure out what the links are that would break? (I vaguely recall seeing dialogs like that that include links to the things that would break)

I have not tested this properly. What I did was to delete an item's catalog entry and then visiting its URL. The item is still available but no longer shows in folder_contents.

The folder_contents dialog seems to show warnings that links will break for corresponding items in other shared media folders (LIF).

I just tested this in a backup and indeed, the links will break. The language folder gets deleted and the catalog entries for items in corresponding media folders also disappear. A catalog rebuild is needed so that the shared items become available again in list views.

This is what I was asking if you’d verified that it does this. I don’t actually understand what it means though :slight_smile:

This isn’t surprising: if you delete a catalog entry, folder_contents won’t “see” the item anymore because it displays a folder’s contents based on a catalog query.

So this seems like a good workaround?

To those who are not familiar with the media folder in multi-lingual sites, this is a common and language independent folder (LIF) that gets created inside all language root folders (LRF). The id and title is translated so it is not always "media". Items created in any of the media folders will also appear in other corresponding folders. This makes it easier to reuse resources like images in translations.

I double quoted the word copied because I was not sure if it makes copies or just links. But now I think they are just links. If you delete an item in any media folder it will also disappear in the other directories.

In my case, I wanted to delete a language root folder. Since it contains a media folder, I was not sure how it would affect the other media folders. If I just deleted items in the media folder, it would have been an issue as this would really remove them.

All media folders (Language Independent Folder or LIF) are basically the same, because when creating one the internals of the other folders are copied, here is the relevant code:


Regarding the delete of a Language Root Folder (LRF), I made a quick test on https://demo.plone.org:

1- Go to /eu/media (the Language Independent Folder - LIF) and create an image.
2- Go to /folder_contents, and delete the 'eu' folder.
3- Go to the Plone Control Panel -> Languages and remove "eu" from the available language folders
4- Go to the /en/assets folder (LIF), you will see nothing there.
5- Go to the /en/assets/manage_main, you will see the image there.
6- Go to the portal_catalog and hit "Clear and rebuild"
7- Go to the /en/assets folder (LIF), and the image created in (1) is there.

So, the items added to the LIF are not deleted when you delete a LRF, but you may need to rebuild the catalog to show them correctly in the folders.

You may want to add an issue regarding this (you need to rebuild the catalog after deleting a LRF in the plone.app.multilingual issue tracker (https://github.com/plone/plone.app.multilingual/issues).

In any case, test this in a copy of your site before breaking anything :slight_smile:

1 Like

Thank you for your reply. The above is also what I did to resolve the problem (delete the language folder and then rebuild the catalog). Of course, I had to test this first on a staging server.

I filed a bug report for this issue here Deleting a Language Folder Requires a Catalog Rebuild · Issue #359 · plone/plone.app.multilingual · GitHub