Reuse the Multilingual features of Alfresco

303 views
Skip to first unread message

David Crespo

unread,
Aug 21, 2012, 2:12:42 PM8/21/12
to alfresco-techn...@googlegroups.com

I'd like to reuse the Multilingual feature that Aflresco uses such as title or description properties from ContenModel.xml. So that I can use Share to input text in different languages for the same property. If I can reuse this feature

Alfresco will store the texts in different languages for my property in the same way it makes that for the title and the description properties.

I know that MLText and MLPropertyInterceptor Classes are involved in that feature but I'd like to know if I could achieve my aim using this approach. Does anyone face with this issue? Could anyone say something useful about it?

Thanks,

David.

David Crespo

unread,
Aug 22, 2012, 2:45:20 PM8/22/12
to alfresco-techn...@googlegroups.com
Hi, 

I just updated this issue adding more details about what is my problem and also some suggestions. You could have a look at it going to http://goo.gl/mRmi8 

Thanks,

David.

Richard Esplin

unread,
Aug 23, 2012, 10:12:08 AM8/23/12
to alfresco-techn...@googlegroups.com, David Crespo
We don't have much guidance on this topic, so even though I don't have any real-world experience to add here, I'll share this information to get it into the log:

* The repository supports multi-lingual content and multi-lingual search.

* The documentation for the multi-lingual features in Explorer are here:

http://docs.alfresco.com/4.0/topic/com.alfresco.enterprise.doc/tasks/tuh-multilingual.html

But Google shows an old document in JIRA that has more detailed instructions:

https://issues.alfresco.com/jira/secure/attachment/13418/Using%2BMultilingual%2BFeatures%2Bin%2BAlfresco.pdf

* The documentation for Explorer describes a nice feature where you can version batches of multi-lingual content as "editions".

* The Share UI decides what language is desired based on the browser locale settings.

* With Lucene search results for each locale are kept separate. To combine them it was necessary to drop all the index grammars except the English/default one. This JIRA issue documents the Lucene search behavior:

https://issues.alfresco.com/jira/browse/ALF-3359

* I'm told that with Solr this should not be an issue anymore.

* Web Quick Start adds some support for multi-lingual content into Share. The documentation is here:

http://docs.alfresco.com/4.0/topic/com.alfresco.enterprise.doc/concepts/qs-ml-intro.html

* Full support for multi-lingual content in Share is a feature we are still working on. I have been told that some of our European customers have implemented this sort of support, but for reasons of scheduling and engineering resources it hasn't made it into core yet.

I understand that this isn't a complete answer, but it is what I could find. Hopefully this information proves useful.

Richard

On Wednesday August 22 2012 12:45:20 David Crespo <davidcre...@gmail.com> wrote:
> Hi,
>
> I just updated this issue adding more details about what is my problem and
> also some suggestions. You could have a look at it going
> to http://goo.gl/mRmi8
>
> Thanks,
>
> David.
>
> On Tuesday, 21 August 2012 19:12:42 UTC+1, David Crespo wrote:
> >
> > I'd like to reuse the Multilingual feature that Aflresco uses such as
> > title or description properties from ContenModel.xml. So that I can use
> > Share to input text in different languages for the same property. If I can
> > reuse this featureAlfresco will store the texts in different languages

David Crespo

unread,
Aug 23, 2012, 10:16:34 AM8/23/12
to alfresco-techn...@googlegroups.com, David Crespo
Hi Richard,

Thank you for you post. I'll have a look at it in more detail later and come here with my feedbacks.

David.

David Crespo

unread,
Aug 27, 2012, 7:47:35 PM8/27/12
to alfresco-techn...@googlegroups.com, David Crespo
Hi Richard,

I just read your email in depth. Although your email can´t give a solution to my question I have to say that it was useful to get an understanding how multilingual content works in Alfresco Explorer and Share. 

Thanks.

Richard Esplin

unread,
Sep 11, 2012, 1:14:23 PM9/11/12
to alfresco-techn...@googlegroups.com
One of my teammates provided additional guidance on this topic:

* The wiki page on multi-lingual web quick start has a lot of additional explanation and screen shots that are not in the official docs that I linked to earlier:

http://wiki.alfresco.com/wiki/Multi-lingual_Web_Quick_Start

* There was an internal document floating around that updated the wiki page on multi-lingual content. I updated the wiki page to match the document, and I uploaded some example code. This additional information is more complete than what was there, but is still very old and incomplete. It does not answer any questions about exposing multi-lingual content in Share.

https://wiki.alfresco.com/wiki/Multilingual_Document_Support

* I created a wiki page to start collecting information about multilingual support in share. At the moment it only contains the information that was part of this conversation.

https://wiki.alfresco.com/wiki/Multilingual_Share

If anyone has additional information, please update the wiki pages or at least contribute to this conversation.

Cheers,

Richard

David Crespo

unread,
Sep 12, 2012, 6:09:06 PM9/12/12
to alfresco-techn...@googlegroups.com
Hi Richard,

Good job. It´s a good and updated compilation about multi-lingual content in Alfresco. Also the sample provided is really useful. If I can add something new I´ll do it.

Many thanks,

David.


--
You received this message because you are subscribed to the Google Groups "Alfresco Technical Discussion" group.
To post to this group, send email to alfresco-techn...@googlegroups.com.
To unsubscribe from this group, send email to alfresco-technical-d...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/alfresco-technical-discussion?hl=en.




--
David Crespo Arroyo
Manager and developer of ECM projects based on Alfresco. 
Alfresco Certified Instructor.  Alfresco Certified Engineer.

David Crespo

unread,
Sep 18, 2012, 7:25:55 AM9/18/12
to alfresco-techn...@googlegroups.com
Hi Tom,

I am trying to add new Fields in the Form from the Filter before generating the Form. However I am having problems to find out how to create a new Fields and add them to the Form so that Share could display it without adding configuration in Share-config-custom.xml file. Could explain how to add new Fields (into this fields I'll put the mlvalues) to the Form?

Thanks,

David.

On Friday, 14 September 2012 10:26:20 UTC+1, Tom Morris wrote:
Hi David,

For completeness, I'll re-post my previous response to you, from the Linked-In forum, here:


For properties of type MLText, I would first use 'setMLAware(true)' to prevent the nodeService from simply returning a single default string. Instead this will return a map of the property values, with the locale as the key for each language value.

boolean wasMLAware = MLPropertyInterceptor.setMLAware(true);
try {
MLText desc = (MLText) nodeService.getProperty(nodeRef, ContentModel.PROP_DESCRIPTION)
}
finally {
MLPropertyInterceptor.setMLAware(wasMLAware);
}

http://dev.alfresco.com/resource/docs/java/datamodel/org/alfresco/service/cmr/repository/MLText.html

This doc shows how you can cycle through all the locale value variations for the property.

I would then use the Alfresco Forms service and it's filter capability:
http://wiki.alfresco.com/wiki/Forms_Developer_Guide#Form_Filter

This is what we're after:
"allows a form definition to be manipulated before and/or after generation and form data to be manipulated before and/or after being persisted"

Instead of rendering just the one entry field for the property, you can render it multiple times, using different names. I think would then take the same approach to naming as you would for index queries and add the locale as a suffix to the name, e.g. 'description_en'.

On submission of the form, I would again use the forms filter to map these values back to the single MLText value.

A different approach is described on Peter Löfgren's blog (http://loftux.com/2011/10/30/alfresco-multilingual-properties-feature-or-bug/) where I think he uses an enhanced form-control, although no code examples are provided. I think a combination approach would also work.

On a related matter, you may find attending this session at the forthcoming Alfresco DevCon2012 useful: http://devcon.alfresco.com/berlin/sessions/multilingual-alfresco-share

Tom 
David.

To unsubscribe from this group, send email to alfresco-technical-discussion+unsub...@googlegroups.com.

David Crespo

unread,
Sep 18, 2012, 10:38:57 AM9/18/12
to alfresco-techn...@googlegroups.com
I gave up trying to add new Fields into the Form for the mlValues. What I have done is to use:
  form.addFieldDefinition(propFieldDef);
  form.addData(dataKeyName, value);

And add in Share-config-custom file the configuration to show my new properties in Share. It works well and in Share I can see the mlvalues for the properties. I thought that if I added the Field into the Form in the Filter class I wouldn't have to add configuration in Share to display my new properties. I was wrong.

Thanks,
David.
Reply all
Reply to author
Forward
0 new messages