cancel
Showing results for 
Search instead for 
Did you mean: 

How to make task form multilingual?

pnature
Star Contributor
Star Contributor

Hi.

I am new and I am using Alfresco 5.1 community version.

I have made some workflows with customized tasks defined in workflow model

        <type name="ipp:incomingPostTask">
            <parent>bpm:activitiOutcomeTask</parent>
            <associations>
              <association name="ipp:assignee">
                <title>Assignee</title>
                <source>
                  <mandatory>false</mandatory>
                  <many>false</many>
                </source>
                <target>
                  <class>cm:person</class>
                  <mandatory>true</mandatory>
                  <many>false</many>
                </target>
              </association>
            </associations>
            <mandatory-aspects/>
        </type>

Now I want to make this task form multilingual. In this case I want to change title Assignee for example to Rechtsnachfolger.

How to achieve this?

Thanks in advance.

1 ACCEPTED ANSWER

pnature
Star Contributor
Star Contributor

Fortunately I found a solution.

Just name property files in directory share/.../messages like this:

anyName_en.properties
anyName_fr.properties

Context file in share have to point at these files.

Now forms defined in share-config-custom.xml can use label-id="property".

View answer in original post

8 REPLIES 8

douglascrp
World-Class Innovator
World-Class Innovator

Hello.

You can see some examples in the Alfresco's source code.

In the following links you can check how the localization is done for the OOTB workflows

The registry:

community-edition-old/bootstrap-context.xml at 2c1eff9953d3105e738f7b06ba9ba8a079ca4c24 · Alfresco/c... 

And the localization files:

community-edition-old/projects/repository/config/alfresco/workflow at 2c1eff9953d3105e738f7b06ba9ba8... 

Thank you for response.

But I can't see all needed associations.

My model

<model name="ipp:incomingPostWorkflowModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

has type described above.

In share-config-custom.xml I have defined form which uses type

   <config evaluator="task-type" condition="ipp:headIncomingPostTask">
      <forms>
         <form>
            <field-visibility>
               <show id="message" />
               <show id="packageItems" />
               <show id="ipp:assignee" />
               <show id="bpm:comment" />
               <show id="transitions" />
            </field-visibility>
            <appearance>
               <set id="" appearance="title" label-id="workflow.set.task.info" />
               <set id="info" appearance="" template="/org/alfresco/components/form/3-column-set.ftl" />
               <set id="progress" appearance="title" label-id="workflow.set.task.progress" />
               <set id="items" appearance="title" label-id="workflow.set.items" />
               <set id="response" appearance="title" label-id="workflow.set.response" />
               <field id="message">
                  <control template="/org/alfresco/components/form/controls/info.ftl" />
               </field>
               <field id="packageItems" set="items" />
               <field id="ipp:assignee" label-id="prop.ipp_assignee" set="response">
               </field>
               <field id="bpm:comment" label-id="workflow.field.comment" set="response">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl">
                    <control-param name="saveLineBreaks">true</control-param>
                 </control>
               </field>
               <field id="transitions" set="response" />
            </appearance>
         </form>

In Share-amp incomingPostProcess-share-amp-slingshot-application-context.xml I have defined two property files for two languages

    <bean id="incomingPostProcess-share-amp.resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
        <property name="resourceBundles">
            <list>
                <value>alfresco.web-extension.messages.incomingPostProcess-share-amp</value>
                <value>alfresco.web-extension.messages.incomingPostProcess-share-amp_fr</value>
            </list>
        </property>
    </bean>

These two files are stored in src/main/amp/config/alfresco/web-extension/messages and contain label definitions

prop.ipp_assignee=Assignee
ipp_incomingPostWorkflowModel.type.ipp_headIncomingPostTask.association.ipp_assignee.title=Assignee
ipp_incomingPostWorkflowModel.type.ipp_headIncomingPostTask.title=Type title
wf_review.node.review.transition.taskDone.title=Done
ipp_incomingPostWorkflowModel.type.ipp_incomingPostProcess.title=Incoming post process

But it's not working.

douglascrp
World-Class Innovator
World-Class Innovator

Hello.

I can see two problems in the way you configured your project.

The properties files for the localization should be placed in the repository project, and not in the share one.

In order to create, register and define the localized properties, you should be reading the following tutorial, which describes all the required steps.

Content Model - Defining and Deploying | Alfresco Documentation 

In the register model bean, you need something like this:

<bean id="org.alfresco.tutorial.customcontentmodelrepo.dictionaryBootstrap"
   parent="dictionaryModelBootstrap"
   depends-on="dictionaryBootstrap">

   <property name="models">
      <list>
         <value>alfresco/module/<module-id>/model/content-model.xml</value>
      </list>
   </property>
   <property name="labels">
      <list>
         <!-- Bootstrap Resource Bundles for data list type and properties -->
         <value>alfresco/module/${project.artifactId}/messages/content-model</value>
      </list>
   </property>
</bean>

I believe you already have that, or you would not be able to execute your workflow. You probably have it defined, but should be missing the labels part.

And that is the second problem I see with your code.

You have to define just the base properties file name, and not the "local" part.

I mean, using your sample code, you just need the incomingPostProcess-share-amp, and the incomingPostProcess-share-amp_fr is not required at all.

Try to follow the tutorial and let us know if it was useful.

Thank you. Information is somehow useful but still not clear enough.

I have stopped work with share and I have added files content-model.properties and content-model_fr.properties into messages directory.

ipp_incomingPostWorkflowModel.association.ipp_assignee.title=Le cessionnaire

But this title (from content-model_fr.properties) is showing for both languages (en/fr).

When I rename file content-model.properties to content-model_en.properties it has started to work.

douglascrp
World-Class Innovator
World-Class Innovator

Share your bean configuration here.

Bootstrap
    <bean id="incomingPostProcess-repo-amp.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/module/${project.artifactId}/model/content-model.xml</value>
                <value>alfresco/module/${project.artifactId}/model/workflow-model.xml</value>
            </list>
        </property>
        <property name="labels">
           <list>
              <value>alfresco/module/${project.artifactId}/messages/workflow-model</value>
           </list>
        </property>
    </bean>
Service
    <bean id="incomingPostProcess.workflowBootstrap" parent="workflowDeployer">
        <property name="workflowDefinitions">
            <list>
                <props>
                    <prop key="engineId">activiti</prop>
                    <prop key="location">alfresco/module/incomingPostProcess-repo-amp/workflows/incomingPostProcess.bpmn</prop>
                    <prop key="mimetype">text/xml</prop>
                    <prop key="redeploy">true</prop>
                </props>
            </list>
        </property>
    </bean>

Hi.

Now I can translate properties and associations but I cannot translate types and aspects.

Model:

      <aspect name="iw:approveContribution">
            <title>Approvers for Approve Contribution</title>

Share-config-custom.xml contains form

<set id="iw:approveContribution" appearance="bordered-panel" template="/org/alfresco/components/form/2-column-set.ftl" />
<field set="iw:approveContribution" id="iw:approver" />

Properties

iw_contentModel.aspect.iw_approveContribution.title=Approvers for Approve Contribution

Form shows label of bordered panel as "iw:approveContribution"

How to make multilingual label of bordered panel?

Thank you in advance.

pnature
Star Contributor
Star Contributor

Fortunately I found a solution.

Just name property files in directory share/.../messages like this:

anyName_en.properties
anyName_fr.properties

Context file in share have to point at these files.

Now forms defined in share-config-custom.xml can use label-id="property".