Model Localization in Alfresco

We have learned about content modeling in alfresco in previous few posts. Now after creating the content model there are some times comes a requirement of localizing that content model. What we had seen in previous post is simple content model where all the titles related to aspect, type and properties are in model XML file hard coded in English.

To support localization of a model, you can augment the model XML values with locale-specific values by registering a standard Java resource bundle for each language variant of a model. Localizing content-model values is often required to render user interfaces that are driven from the content model, such as a property sheet that displays a grid of property name and value.

The content models provided out of the box are all augmented with a default (for US English) Java resource bundle. The following is an extract from the resource bundle for the ECM domain model:

cm_contentmodel.description=Alfresco Content Domain Model

cm_contentmodel.type.cm_object.title=Object

cm_contentmodel.type.cm_object.description=Base Content Domain Object

cm_contentmodel.property.cm_name.title=Name

cm_contentmodel.property.cm_name.description=Name

cm_contentmodel.type.cm_folder.title=Folder

cm_contentmodel.type.cm_folder.description=Folder

Resource bundles are composed of many key/value pairs. For content models, the keys are structured as follows:

<model_prefix>_<model_name>.[title|description]

In our case

custom_customModel.customType

or

<model_prefix>_<model_name>.<feature>.<feature_prefix>_<feature_name>. [title|description]

Where:

  • model_prefix is the model namespace prefix.
  • model_name is the model name.
  • feature is one of type, aspect, property, association, constraint, or data type.
  • feature_prefix is the namespace prefix of the feature definition name.
  • feature_name is the feature definition name.

Resource bundle Registration

Content model resource bundles must be registered with their associated content model. It can be done by adding following entry in context file. The Dictionary Bootstrap component supports the additional labels property, which allows for a list of resource bundle files (located in the classpath) to be specified. You must restart the Alfresco content repository to register the resource bundle.

<bean id="customModel.extension.dictionaryBootstrap" parent="dictionaryModelBootstrap"

depends-on="dictionaryBootstrap">

<property name="labels">

<list>

<value>alfresco/extension/customModel.properties</value>

</list>

</property>

</bean>

This is how we can localize any custom content model within alfresco.

Looking for quality Alfresco Web Hosting ? Look no further than Arvixe Web Hosting !

Tags: , , , , | Posted under Alfresco | RSS 2.0

Author Spotlight

mitpatoliya

mitpatoliya

I love opensource technologies working with those technologies from the time I have stepped in to the Software Industry. Alfresco CMS is my area of expertise. I have worked on various complex implementations which involved integration of Alfresco with other technologies, extensively worked with JBPM workflows and Webscripts.

Leave a Reply

Your email address will not be published. Required fields are marked *


+ 7 = 12

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>