Important
You are browsing upcoming documentation for version 6.1 of OroCommerce, scheduled for release in 2025. Read the documentation for version 6.0 (the latest LTS version) to get up-to-date information.
See our Release Process documentation for more information on the currently supported and upcoming releases.
Workflow Translation Wizard
WorkflowBundle supports the translation functionality and each workflow (in part of its text fields) can be translated into multiple languages. This topic explains how to use it when creating new workflow configuration or updating the existing one.
Study the following three steps below:
Step 1
First of all, you should have your workflow configuration itself loaded, it is located in the <YourBundle>/Resources/config/oro/workflows.yml file and can be loaded by the oro:workflow:definitions:load command.
Hint
See Configuration Reference for more details.
For example:
bin/console oro:workflow:definitions:load --directories=$YOUR_BUNDLE_DIR/Resources/config/oro
Step 2
After your valid configuration is ready, add translations or user-friendly text representations of the configuration pieces.
You can load workflow translations from their translation files located in the <YourBundle>/Resources/translations/workflows.{lang}.yml file (the same behavior as messages.{lang}.yml in Symfony defaults). To fill valid keys with translation text, use the oro:workflow:translations:dump command that dumps all keys related to your workflow translation to the output (stdout), and can be used to build the workflows.{lang}.yml file.
For example, this is how you would create a translation file directly by redirecting output of command to a file.
bin/console oro:workflow:translations:dump my_workflow --locale=en > $YOUR_BUNDLE_DIR/Resources/translations/workflows.en.yml
This way, file <YourBundleDirectory>/Resources/translations/workflows.en.yml is filled by translation keys tree with empty strings, so a developer can fill their values with proper text (English in the example).
If your workflow is extended from a different workflow, you may want to inherit existing translations from that parent workflow. To do so, pass the name of the parent workflow as the –parent-workflow option value. Any translations that are not present in your workflow will automatically be copied from the parent workflow.
bin/console oro:workflow:translations:dump my_workflow --locale=en --parent-workflow=the_parent_workflow > $YOUR_BUNDLE_DIR/Resources/translations/workflows.en.yml
Step 3
When the translation file is updated, you might need to load translations into the system from that file; for this, run the oro:translation:load command.
Now, if you need to update an existing workflow, you can perform the same operations because dumped translations of oro:workflow:translations:dump will be filled by the existing and newly created nodes of the text. For full customization, (replace config nodes, rename them), dump the output of command elsewhere so you could manually choose what to update.
Hint
To rebuild translation cache, use the oro:translation:rebuild-cache command.
to download and update translations, use the oro:translation:update command.