Blog

Alfresco and ECM

Alfresco multilingual properties – feature or bug?

oct 30 2011

Categories : Notes

Many of you that use Alfresco is probably not aware of that Alfresco has built in support for multilingual properties. Out of the box Alfresco use this for Title and Description, but only for those two. What this means for documents is that if you are logged into Share as a user with en_US locale preferences and create a document with title “My English Title” and description “My English description”, then a user with sv_SE (as in swedish) updates the properties to title “My Swedish Title” and description “My Swedish description”, any user with en_US will still see the original text, sv_SE user will see the “translated” Swedish text. For this to happen you do not need to have that language pack installed. To test this I recommend Firefox with the plugin Quick Locale Switcher.

This is a very nice feature, that just works. But there are some problems with this. First there is no indication in Share forms that this happens, there should at least be visual indication that it is. Second problem is that the title and description properties are not just used for documents, they are user for many other components in Alfresco. I have done some testing, and I have found that Site name and description, Blog posts title, Discussion topic title, Data List name and description, and Data List entry name and description will show different texts depending on locale if it has been edited with different locale. Again this only happens if edited with a different locale, probably not happening so many times that a Discussion is edited with different locales, but that Site Managers from different countries change Site title and description is not unlikely.

It was a client of mine that first noticed this behavior, and I filed a bug ALF-3756 in July 2010. My initial reaction was that users should not see different things, and that is was because user user different browsers, and that this should be fixed. As it turns out, it is not because of different browsers, it is because of different locale preference set in different browsers. It was recently fixed in HEAD, so happily testing this out, nothing had changed and the behavior is the same. So i filed a regression bug ALF-11166, but after thinking of the multilingual behavior, it may be that it is not a bug after all, and this is why I’m writing this post.

I’ve thought of ways to fix this, one could be that you change the property definition of cm:title and cm:description in the data model from d:mltext to d:text. Some limited testing shows that this work, a property will stay multilingual (d:mltext) until next edit, then it is saved as d:text, and all user see the same thing regardless of locale. Changing the default model is nothing I recommend, and I only did very limited testing just to see what happened. And this is probably not the way to fix this, because it removes a nice feature. Alfresco is very locale (I18N for the hardcore) aware, you can localise almost everything, and from 4.0 property lists (constraints) can be localized. So the very fact that you can have a Site title and description in different locale is a good thing.

So the proper fix for this is to visually indicate what is going on in all forms and dialogs. It can be implemented in steps if not the full approach can be taken at once

  1. Create a control with flag corresponding to the locale used, so that you visually see what locale is currently being edited.
  2. Change the control so that you can list other values to see base language and the current values for other locales. That way you can keep track of translations and keep them in sync.

I created (or actually updated existing text controls) and then it looks like this for multilingual properties

Full details on how I did this is in the issue ALF-11166. Its a simple first step with just editing the control freemarker templates, a more complete solution would be as I outlined the possibility to list all added values for different languages. Let me know what you think.