Skip to content

Installation

phil/translation-bundle

Requirements

RequirementWhy
PHP 8.5 or laterReadonly classes, typed constants, new without parentheses
phil/translation-memorySegments, segmentation, memory, glossary and XLIFF
phil/ujoThe documents translated
doctrine/orm 3.7The tables of segments, memory and terms
twig/twig 3.21The translation screen
symfony/http-foundation, symfony/http-kernel, symfony/routing 8.2The screen's controller and routes
symfony/security-csrf 8.2The stateless CSRF check of the screen's forms
symfony/stimulus-bundle, symfony/asset-mapper, optionalThe screen's csrf controller, without a build step
easycorp/easyadmin-bundle, optionalThe menu links to the glossary pages in an EasyAdmin back office
symfony/config, symfony/dependency-injection 8.2The configuration and services
psr/clockThe times rows are written

The application provides the services clock (Symfony's ClockInterface), twig and router, which the full stack framework registers, and DoctrineBundle for the entity manager.

Installing

composer require phil/translation-bundle
// config/bundles.php
return [
    // …
    Phil\TranslationBundle\PhilTranslationBundle::class => ['all' => true],
];

The tables

The bundle maps its rows for Doctrine itself — no mappings entry to write. Create the tables with the application's migrations:

bin/console doctrine:migrations:diff
bin/console doctrine:migrations:migrate

Storage describes the four tables.

The screen

Import the routes behind the application's firewall, under a prefix of its choice:

# config/routes/phil_translation.yaml
phil_translation:
    resource: '@PhilTranslationBundle/config/routes.php'
    prefix: /admin/translate

Then name the application's documents and who may translate them — the translation screen shows both services. Without them the screen and the glossary pages answer 404; the services of Translations work all the same. A Translators service signs targets and comments and credits translators in public (Comments and credits); machine translation stays off until a translator is named (Machine translation).