Home

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:

1
2
3
4
5
6
7
8
9
10
11
12
13
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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<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 !

Publicités

Laisser un commentaire

Choisissez une méthode de connexion pour poster votre commentaire:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion / Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion / Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion / Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion / Changer )

Connexion à %s