Multi-lingual task name

I am attempting to set a dynamic name (from variables) on a task in both English and French. Setting it to english is working fine:

<userTask id="sid-20F0CE . . ." name="${requestTypeName}">
</userTask>

When trying to use the localization tag and a variable, I discovered that the variables do not get evaluated within this tag. Another post on this forum confirmed this:

<extensionElements>
    <flowable:localization locale="fr" name="${requestTypeName_FR}" />
</extensionElements>

I then removed the above tag and tried setting the localized name on the task object.

Task task = taskService.createTaskQuery().taskId(taskId).locale("fr").singleResult();
task.setLocalizedName("Nom Francais");
taskService.saveTask(task);

This appears to change the actual name of the task and not the localized name. Retrieving that task in both English and French now returns the value “Nom Francais”. The schema of the database does not appear to support the ability to store names in multiple languages. I am unsure what setLocalizedName does as opposed to setName.

I was able to trace through the code and noticed that the localized values are read in from the DefaultTaskLocalizationManager class. This is where the values get read from the process definition localization nodes.

I also looked into the DynamicBmpnService, more specifically the changeLocalizationName methods. Again, the problem is that this service deals with the process definition and not the process instance.

I am looking for the ability to dynamically set the task name, in multiple languages, on a per process instance level based on variables and not rely on static values from the process definition. The only solution I can think of is to implement my own DefaultTaskLocalizationManager and do the variable evaluation when reading the localization node. Not quite sure how I would do this.

If anyone has done something similar or has some ideas, please send them my way.

Stephane

Hi Stephane,

I’m dealing with the same issue here. And I’m considering 2 possible ways (havn’t decide yet):

  1. Store the translation in the Process Definition xml. The problem, is that when a new translation is made I will have to change the process definition.

  2. Store the translation in a custom table, (with access key Process Definition, Task Definition, variable, locale, text). In this table I’ll only store the translation, since the bpmn will have a main language that will be common for all.

I’m more tented for the 2nd option, because it can dynamically add a new translation (and some times correct the one that was previous given…) and it is not necessary to change the processDefinition. I would prefer to have some mechanism included in flowable (a table for process definition variables can help mitigate this) …

Filipe

have u solved this problem ? i am so comfused by this