cancel
Showing results for 
Search instead for 
Did you mean: 

Content Model Localization in Share

bbougon
Champ in-the-making
Champ in-the-making
Hello,

I do have a problem with localization in Share.
I am desperatly trying to have the title of my custom aspects in Share content details page and I do not know what to do (works well in explorer).

Here is my problem :
1 - I have created some custom aspects added to the default content model (itself rewritten in the alfresco's extension folder).
2 - Localization for Explorer is written in the webclient.properties and works well
3 - In the share-config-custom.xml I have added the following lines (as shown in the wiki) :

<config evaluator="aspect" condition="mbs:status">
      <forms>
         <form>
            <field-visibility>
               <show id="mbs:statusName" label="statusName" label-id="statusName" for-mode="view" />
               <show id="mbs:statusDate" label="statusDate" label-id="statusDate" for-mode="view" />
            </field-visibility>
         </form>
      </forms>
   </config>
   
   <config evaluator="aspect" condition="mbs:confidential">
      <forms>
         <form>
            <field-visibility>
               <show id="mbs:confidentialName" label="confidentialName" label-id="confidentialName" for-mode="view" />
            </field-visibility>
         </form>
      </forms>
   </config>
4 - I have added the following translations into a slingshot.properties (itself declared in the custom-slinghsot-application-context.xml) :

aspect.mbs_status.mbs_statusName=Statut
aspect.mbs_status.mbs_statusDate=Date de statut
aspect.mbs_confidentialName=Confindentialit\u00e9

aspect.mbs_status.mbs_statusDate.label=Date de Statut
aspect.mbs_status.mbs_statusName.label=Statut
aspect.mbs_status.mbs_confidentialName.label=Confindentialit\u00e9

aspect.mbs_status.mbs_statusDate.title=Date de Statut
aspect.mbs_status.title.mbs_statusName.title=Statut
aspect.mbs_status.mbs_confidentialName.title=Confindentialit\u00e9

aspect.mbs_status.property.mbs_statusName.title=Statut
aspect.mbs_status.property.mbs_statusDate.title=Date de statut
aspect.mbs_confidential.property.mbs_confidentialName.title=Confindentialit\u00e9

None of the above declaration works.

If anyone has a solution, thx by advance

Bertrand
9 REPLIES 9

loftux
Star Contributor
Star Contributor
It is picked up from the repository assuming you have localized your model there. Remove the label from share config and it should work.

bbougon
Champ in-the-making
Champ in-the-making
Hello,

thanks for the advice.
Unfortunatly it does not work.

I have tried different things like :
- removing the "label" (as you said)
- removing both "label" and "label-id"
- adding a field "name" (I've seen some declaration with this field)
And I changed some properties in the slingshot but nothing changed :

share-config-custom.xml

<config evaluator="aspect" condition="mbs:status">
      <forms>
         <form>
            <field-visibility>
               <show id="mbs:statusName" label-id="statusName" for-mode="view" />
               <show id="mbs:statusDate" for-mode="view" />
            </field-visibility>
         </form>
      </forms>
   </config>
   
   <config evaluator="aspect" condition="mbs:confidential">
      <forms>
         <form>
            <field-visibility>
               <show id="mbs:confidentialName" name="mbs:confidentialName" label-id="confidentialName" for-mode="view" />
            </field-visibility>
         </form>
      </forms>
   </config>

slingshot.properties

statusName=Statut
statusDate=Date de statut
confidentialName=Confindentialit\u00e9

mbs_statusName=Statut
mbs_statusDate=Date de statut
mbs_confidentialName=Confindentialit\u00e9

aspect.mbs_status.mbs_statusDate.label=Date de Statut
aspect.mbs_status.mbs_statusName.label=Statut
aspect.mbs_status.mbs_confidentialName.label=Confindentialit\u00e9

aspect.mbs_status.mbs_statusDate.title=Date de Statut
aspect.mbs_status.title.mbs_statusName.title=Statut
aspect.mbs_status.mbs_confidentialName.title=Confindentialit\u00e9

aspect.mbs_status.property.mbs_statusName.title=Statut
aspect.mbs_status.property.mbs_statusDate.title=Date de statut
aspect.mbs_confidential.property.mbs_confidentialName.title=Confindentialit\u00e9

loftux
Star Contributor
Star Contributor
You are not supposed to add your labels to slingshot.properties, it goes to your custom model in the alfresco repository.
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
    <!– Registration of new models –>   
    <bean id="customModel.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/customModel.xml</value>
            </list>
        </property>
        <property name="labels">
            <list>
                <value>alfresco/messages/custommodel</value>
            </list>
        </property>
    </bean>
</beans>
Now in put your labels in alfresco/messages/custommodel.properties. And for localisation, custommodel_xx_YY.properties for each language you want to support.

bbougon
Champ in-the-making
Champ in-the-making
Hi Loftux,

thanks for the answer but I allready donne that and it does not work.
Let me put below all the files, what I think is that I do not write the right properties and at least, Share do not find the translation.

custom-content-model.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

   <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
      <property name="models">
         <list>
            <value>alfresco/extension/model/customContentModel.xml</value>
         </list>
      </property>
      <property name="labels">
         <list>
            <value>alfresco/extension/messages/content-model</value>
         </list>
      </property>
   </bean>

</beans>

customContentModel.xml (truncated)


<?xml version="1.0" encoding="UTF-8"?>
<!– xsi:schemaLocation="http://www.alfresco.org/model/dictionary/1.0 modelSchema.xsd" –>
<model name="cm:contentmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <description>Alfresco Content Domain Model</description>
   <author>Alfresco</author>
   <published>2009-06-04</published>
   <version>1.1</version>

   <imports>
      <import uri="http://www.alfresco.org/model/dictionary/1.0"
         prefix="d" />
      <import uri="http://www.alfresco.org/model/system/1.0" prefix="sys" />
   </imports>

   <namespaces>
      <namespace uri="http://www.alfresco.org/model/content/1.0"
         prefix="cm" />
      <namespace uri="http://www.alfresco.org/model/rendition/1.0"
         prefix="rn" />
      <namespace uri="http://www.alfresco.org/model/exif/1.0"
         prefix="exif" />
      <namespace uri="http://www.cvf.fr/model/mbs/1.0"
         prefix="mbs" />
   </namespaces>

   <constraints>

      …      
      
      <constraint name="mbs:status_constraint" type="LIST">
         <parameter name="allowedValues">
            <list>
               <value>Draft</value>
               <value>In Progress</value>
               <value>Validate</value>
               <value>Approval in Progress</value>
               <value>Approved</value>
               <value>Archived</value>
               <value>Deprecated</value>
            </list>
         </parameter>
      </constraint>
      <constraint name="mbs:confidential_constraint" type="LIST">
         <parameter name="allowedValues">
            <list>
               <value>Public</value>
               <value>Confidential</value>
               <value>MBS Confidential</value>
            </list>
         </parameter>
      </constraint>
   </constraints>

   <types>

      …

      <type name="cm:content">
         <title>Content</title>
         <parent>cm:cmobject</parent>
         <archive>true</archive>
         <properties>
            <property name="cm:content">
               <type>d:content</type>
               <mandatory>false</mandatory>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>false</stored>
                  <tokenised>true</tokenised>
               </index>
            </property>
         </properties>
         <mandatory-aspects>
            <aspect>cm:versionable</aspect>
            <aspect>cm:taggable</aspect>
            <aspect>cm:generalclassifiable</aspect>
            <aspect>mbs:status</aspect>
            <aspect>mbs:confidential</aspect>
         </mandatory-aspects>
      </type>

      …
      
      <aspect name="mbs:status">
         <title>MBS Status</title>
         <properties>
            <property name="mbs:statusName">
<!–                <title>Status</title> –>
               <type>d:text</type>
               <default>Draft</default>
            </property>
            <property name="mbs:statusDate">
<!–                <title>Status Date</title> –>
               <type>d:datetime</type>
            </property>
         </properties>
      </aspect>
      <aspect name="mbs:confidential">
         <title>MBS Confidential</title>
         <properties>
            <property name="mbs:confidentialName">
<!–                <title>Confidential</title> –>
               <type>d:text</type>
               <default>MBS Confidential</default>
            </property>
         </properties>
      </aspect>

   </aspects>

</model>


content-model_xx_XX.properties (with many possible traductions because I don't know what path to write for the translation

cm_contentmodel.aspect.mbs_status.property.mbs_statusName.title=Status
cm_contentmodel.aspect.mbs_status.property.mbs_statusDate.title=Status date
cm_contentmodel.aspect.mbs_confidential.property.mbs_confidentialName.title=Confidentiality

aspect.mbs_status.mbs_statusName=Statut
aspect.mbs_status.mbs_statusDate=Date de statut
aspect.mbs_confidentialName=Confindentialit\u00e9

aspect.mbs_status.mbs_statusDate.label=Date de Statut
aspect.mbs_status.mbs_statusName.label=Statut
aspect.mbs_status.mbs_confidentialName.label=Confindentialit\u00e9

aspect.mbs_status.mbs_statusDate.title=Date de Statut
aspect.mbs_status.title.mbs_statusName.title=Statut
aspect.mbs_status.mbs_confidentialName.title=Confindentialit\u00e9

aspect.mbs_status.property.mbs_statusName.title=Statut
aspect.mbs_status.property.mbs_statusDate.title=Date de statut
aspect.mbs_confidential.property.mbs_confidentialName.title=Confindentialit\u00e9

mbs_statusName.title=Statut
mbs_statusDate.title=Date de statut
mbs_confidentialName.title=Confindentialit\u00e9

mbs_statusName=Statut
mbs_statusDate=Date de statut
mbs_confidentialName=Confindentialit\u00e9

statusName=Statut
statusDate=Date de statut
confidentialName=Confindentialit\u00e9

loftux
Star Contributor
Star Contributor
It should be

cm_contentmodel.aspect.mbs_confidential.title=MBS Confidential
cm_contentmodel.aspect.mbs_confidential.description=MBS Confidential
cm_contentmodel.property.mbs_confidential.title=MBS Confidential
cm_contentmodel.property.mbs_confidential.description=MBS Confidential

And follow the same pattern for the other aspects

A property has the same definition regardless if it origin is from an aspect or a type.
You can read more here http://wiki.alfresco.com/wiki/Data_Dictionary_Guide#Model_Localization

bbougon
Champ in-the-making
Champ in-the-making
Thank you so much, it works!!!

d_franz
Champ on-the-rise
Champ on-the-rise
Since I updated to version 4.2a of Alfresco the translation file (x.properties) worked. Now I get "type.ALIAS_xxx" in the select menu instead of its name.

Is there a new mechanism to set names to types?

loftux
Star Contributor
Star Contributor
Create a file in web-extension called mymodel-context.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
   <bean id="mycustomResourceBundle" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
      <property name="resourceBundles">
         <list>
            <value>alfresco.messages.mycustom</value>
         </list>
      </property>
   </bean>
</beans>

Then in classpath alfresco/messages, create mycustom.properties, mycustom_fr.properties and so on.
In them add
type.ALIAS_xxx=My custom type

mycustom can of course be anything you like, as long as you follow the pattern.

d_franz
Champ on-the-rise
Champ on-the-rise
Thanks a lot. It looks like I had forgotten the context.xml