Closed (fixed)
Project:
Workflow
Version:
2.1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 Nov 2017 at 15:35 UTC
Updated:
5 Jun 2026 at 17:55 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
johnvYou can translate by using the core Translation modules (like any configuration text). I noticed a string is only added to the list if it is first shown on some screen.
Comment #3
anas_maw commentedHello @johnv
You can translate any added field, but you can't translate states.
I have all multilingual modules provided by core enabled. I think there is something missing in configuration declaration.
If i'm missing something please guide me.
Thanks.
Comment #4
johnvTHe Workflow Types can be translated here: /admin/config/regional/config-translation/workflow_type .
I'll be looking for the workflow_states.
This is the online help page for Config Translation: https://www.drupal.org/docs/8/multilingual/translating-configuration
It refers to a page with Maintenance Schema settings: https://www.drupal.org/docs/8/api/configuration-api/configuration-schema...
It seems the annotation for workflow_state is not complete.
Comment #5
johnvInstalling the config inpector module reveils that the 'label' is not exported.
Inspecting the Config Translation code reveils that the WorkflowState Entity needs an Edit form in the annotation and in workflow_ui.routing.yml file. I will try to add an existing subclass of EntityForm.
Comment #6
johnvAttached patch could do the trick. However, it generates an 'Access denied' error, even though all permissions are granted.
Comment #7
johnvAfter enablng 'Content translation', you need to visit /admin/config/regional/content-language where you can enable content types for translation.
After enabling Configuration Translation, visit /admin/config/regional/config-translation to enable config entities (like Workflow, Workflow State, Workflow executed transition-fields).
According to this issue #2272363-10: Config translation - access denied , translatable fields must be of type 'label' or 'text', not 'string'.
Comment #8
johnvComment #9
johnvThe commit 'Make Workflow type labels translatable' is here: http://cgit.drupalcode.org/workflow/commit/?id=578412c
It is not shown due to an incomplete commit message.
Comment #11
johnvAttached patch should do the trick, but both links in the path are colliding.
Requesting for a volunteer that likes meddling with the menu system.
Comment #12
anas_maw commentedI can confirm the last patch make states translatable. but it break states page: /admin/config/workflow/workflow/MY_WORKFLOW/states
and the following comment should be removed from patch "// This collides workflow config and config_translation"
Comment #13
bgronek commentedPlease see below...I left this comment in error.
Comment #14
bgronek commentedI suggest that this be increased to Major as it causes these two very important core features to be incompatible with each other.
Comment #15
johnvAny help is welcome. I don't know how to solve this.
Comment #16
ivan berezhnov commentedComment #17
johnvPerhaps the error occurs because the following routes have the same path: '/admin/config/workflow/workflow/{workflow_type}'
- entity.workflow_type.canonical:
- entity.workflow_type.edit_form:
Comment #18
johnvThe following page gives an example for the canonical link: https://www.drupal.org/docs/8/api/entity-api/introduction-to-entity-api-...
Comment #19
geek-merlinAdjusting title as seemingly basic translation was added in #10.
Comment #20
anas_maw commentedThis patch will fix this issue and will add the ability to translate states and transition labels
Comment #22
anas_maw commentedComment #23
anas_maw commentedFix the last patch as it causes the transition label to be empty
Comment #25
johnvThanks for your patch @Anas_maw.
I have changed the route
path: '/admin/config/workflow/workflow/state/{workflow_state}', adding an extra '/workflow'The UX is not nice, yet. After translation, you cannot easily go back to the original States List.
I tried
path: '/admin/config/workflow/workflow/{workflow_type}/state/{workflow_state}', but the following error appears.Symfony\Component\Routing\Exception\MissingMandatoryParametersException: Some mandatory parameters are missing ("workflow_type") to generate a URL for route "entity.workflow_state.config_translation_overview". in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 182 of core\lib\Drupal\Core\Routing\UrlGenerator.php).
We need some extra work here. The same goes for workflow_config_transition.
However, I cannot find the translate link for transition (labels). I would expect /admin/config/workflow/workflow/MY_WF/transition_labels
Comment #26
anas_maw commentedReroll to work on latest dev version
Comment #27
adaragao commentedOn Drupal 10.3.2, still have the same problem described on #25.
Unfortunately I'm not a programmer, so I would really appreciate if someone can look and fix this.
Thank you.
Comment #28
suhaib_mayyas commentedI created this patch to make Workflow state labels and Workflow configuration transition labels translatable through Drupal core’s Configuration Translation system.
The main goal is to allow Workflow labels to be translated from the admin UI and exported/imported through Drupal configuration sync.
This patch covers two Workflow config entities:
workflow_stateworkflow_config_transitionWhat this patch does
1. Makes Workflow states translatable
In
WorkflowState.php, I changed the config entity definition from:to:
I also added an edit form handler and an
edit-formlink template.This is needed because Drupal’s Configuration Translation system depends on translatable config entities having the correct route/link structure in order to expose translation forms.
2. Makes Workflow transition labels translatable
In
WorkflowConfigTransition.php, I also changed the config entity definition to:I added an edit form handler and an
edit-formlink template for transition config entities as well.This allows transition labels to be handled by Configuration Translation in the same way as Workflow state labels.
3. Adds edit routes for Configuration Translation
I added edit-form routes for both entities:
These routes are mainly required so Drupal can build the Configuration Translation routes correctly.
They are not intended to replace the existing Workflow admin UI.
4. Adds a Translate action for transition labels
In
WorkflowConfigTransitionLabelForm.php, I added a Translate column/action when the current user has thetranslate configurationpermission.This makes it possible to access the translation page directly from the transition labels form.
5. Fixes editable config names for transition labels
I also fixed the editable config names in
WorkflowConfigTransitionLabelForm.php.The form was using:
But for transition labels, it should use:
This ensures the correct transition config entities are tracked by the form.
How to implement the patch
To apply the patch, place the patch file in the project under:
Then open
composer.jsonand add the patch underextra.patches.drupal/workflow:After that, run Composer so the patch is applied:
If the dependencies are already installed and only the patches need to be reapplied, run:
Then rebuild Drupal caches:
You can also confirm that Composer recorded the patch:
Required modules and permissions
This patch depends on Drupal core’s existing configuration translation system.
The following modules should be enabled:
The user also needs this permission:
After applying the patch, caches/routes should be rebuilt:
Configuration sync behavior
This patch works with Drupal’s normal configuration sync process.
Base Workflow config is exported under:
Translated labels are exported under the language override directory:
So the normal commands work as expected:
drush cexexports the translated labels, anddrush cimimports them back into the correct language config collection.Notes
This patch solves the issue of making Workflow state labels and Workflow transition labels translatable through Drupal’s Configuration Translation system.
A few notes:
Comment #29
suhaib_mayyas commentedComment #30
suhaib_mayyas commentedI created this patch to make Workflow state labels and Workflow configuration transition labels translatable through Drupal core’s Configuration Translation system.
The main goal is to allow Workflow labels to be translated from the admin UI and exported/imported through Drupal configuration sync.
This patch covers two Workflow config entities:
workflow_stateworkflow_config_transitionWhat this patch does
1. Makes Workflow states translatable
In
WorkflowState.php, I changed the config entity definition from:to:
I also added an edit form handler and an
edit-formlink template.This is needed because Drupal’s Configuration Translation system depends on translatable config entities having the correct route/link structure in order to expose translation forms.
2. Makes Workflow transition labels translatable
In
WorkflowConfigTransition.php, I also changed the config entity definition to:I added an edit form handler and an
edit-formlink template for transition config entities as well.This allows transition labels to be handled by Configuration Translation in the same way as Workflow state labels.
3. Adds edit routes for Configuration Translation
I added edit-form routes for both entities:
These routes are mainly required so Drupal can build the Configuration Translation routes correctly.
They are not intended to replace the existing Workflow admin UI.
4. Adds a Translate action for transition labels
In
WorkflowConfigTransitionLabelForm.php, I added a Translate column/action when the current user has thetranslate configurationpermission.This makes it possible to access the translation page directly from the transition labels form.
5. Fixes editable config names for transition labels
I also fixed the editable config names in
WorkflowConfigTransitionLabelForm.php.The form was using:
But for transition labels, it should use:
This ensures the correct transition config entities are tracked by the form.
How to implement the patch
To apply the patch, place the patch file in the project under:
Then open
composer.jsonand add the patch underextra.patches.drupal/workflow:After that, run Composer so the patch is applied:
If the dependencies are already installed and only the patches need to be reapplied, run:
Then rebuild Drupal caches:
You can also confirm that Composer recorded the patch:
Required modules and permissions
This patch depends on Drupal core’s existing configuration translation system.
The following modules should be enabled:
The user also needs this permission:
After applying the patch, caches/routes should be rebuilt:
Configuration sync behavior
This patch works with Drupal’s normal configuration sync process.
Base Workflow config is exported under:
Translated labels are exported under the language override directory:
So the normal commands work as expected:
drush cexexports the translated labels, anddrush cimimports them back into the correct language config collection.Notes
This patch solves the issue of making Workflow state labels and Workflow transition labels translatable through Drupal’s Configuration Translation system.
A few notes:
Comment #31
johnvThanks a lot. I made some small change to the patch. This was already open for a long time.