Installation¶
System requirements¶
- Ibexa DXP 4.6 or newer (use the 1.0 branch for eZ Platform 3.3 / PHP 7.4 compatibility)
- PHP with
zip
extension - Any message queue compatible with the Symfony Messenger component such as RabbitMQ.
Step 1: Bundle installation¶
You can choose between install with or without symfony/flex
.
Installation with symfony/flex
¶
composer config --global gitlab-token.gitlab.com gitlab+deploy-token <token>
composer config --json extra.symfony.endpoint '["https://api.github.com/repos/xrowgmbh/recipes/contents/index.json?ref=main","https://api.github.com/repos/ibexa/recipes/contents/index.json?ref=flex/main","flex://defaults"]'
composer config repositories.gitlab.com/612647 composer https://gitlab.com/api/v4/group/612647/-/packages/composer/packages.json
composer require xrow/translation-bundle:2.1.0
Continue with database schema.
Installation without symfony/flex
¶
composer config --global gitlab-token.gitlab.com gitlab+deploy-token <token>
composer config repositories.gitlab.com/612647 '{"type": "composer", "url": "https://gitlab.com/api/v4/group/612647/-/packages/composer/packages.json"}'
composer require xrow/translation-bundle:2.1.0
Bundle configuration¶
Add the bundle to config/bundles.php
and be strict on the order:
Ibexa\AdminUiBundle\EzPlatformAdminUiBundle::class => ['all' => true],
EzSystems\EzPlatformAutomatedTranslationBundle\EzPlatformAutomatedTranslationBundle::class => ['all' => true],
Xrow\TranslationBundle\XrowTranslationBundle::class => ['all' => true],
Route configuration¶
Register the routes in config/routes/xrow_translation.yaml
:
xrow_translation:
resource: '@XrowTranslationBundle/Resources/config/routing.yml'
Continue with database schema.
Step 2: Database schema¶
Preview and create the database tables:
bin/console doctrine:schema:update --dump-sql
bin/console doctrine:schema:update --force
Step 3: Configure RabbitMQ¶
Install RabbitMQ¶
Use the official installation guide by the vendor.
Symfony Configuration¶
We use the MESSENGER_TRANSPORT_DSN
environment variable to define how RabbitMQ can be reached.
Example:
MESSENGER_TRANSPORT_DSN=amqp://guest:password@localhost:5672/%2f/messages
The bundle will create a default transport called translation-manager
that uses
the instance defined by MESSENGER_TRANSPORT_DSN
. But if you have a custom requirement
you can define it in config/packages/xrow_translation.yaml
. For example:
xrow_translation:
message_queue:
transport: my-custom-transport
framework:
messenger:
transports:
my-custom-transport:
dsn: 'amqp://bunny:password@rabbitmq:5672/%2f/messages'
retry_strategy:
max_retries: 0
failure_transport: my-custom-failure-transport
my-custom-failure-transport:
dsn: 'amqp://bunny:password@rabbitmq:5672/%2f/messages'
options:
exchange:
name: my-custom-failure-transport
queues:
messages_my-custom-failure-transport: ~
You will also need to set up a worker to consume the messages (see Symfony documentation). If you use the default transport created by the bundle this will be:
bin/console messenger:consume translation-manager -vv
or if you use a custom transport:
bin/console messenger:consume my-custom-transport -vv
Messages are only handled by the consumer once. Any failed messages will be sent to another queue for manual execution by running the following interactive command:
bin/console messenger:failed:retry --transport=translation-manager-failed -vv
or if you defined a custom transport following the example above, run:
bin/console messenger:failed:retry --transport=my-custom-failure-transport -vv
It's not possible currently to disable the dependency on RabbitMQ, it is needed for importing and exporting.
See also symfony/messenger documentation.