Я хочу сохранить файлы перевода в каталоге, например:
/translations/admin/messages.en.xlf
/translations/admin/validation.en.xlf
/translations/client/messages.en.xlf
/translations/client/validation.en.xlf
И как использовать эти переводы в контроллерах и шаблонах Twig?




Translation Resource/File Names and Locations
Symfony looks for message files (i.e. translations) in the following default locations:
- the translations/ directory (at the root of the project);
- the Resources/translations/ directory inside of any bundle.
The locations are listed here with the highest priority first. That is, you can override the translation messages of a bundle in any of the top two directories.
The override mechanism works at a key level: only the overridden keys need to be listed in a higher priority message file. When a key is not found in a message file, the translator will automatically fall back to the lower priority message files.
Источник: https://symfony.com/doc/4.2/translation.html#translation-resource-file-names-and-locations
И далее на той же странице/главе
You can add other directories with the paths option in the configuration:
config/packages/translation.yaml
framework: translator: paths: - '%kernel.project_dir%/translations/admin' - '%kernel.project_dir%/translations/client'
Вы можете использовать их как любые другие файлы перевода, помня механизм переопределения, указанный здесь выше.
Полная ссылка: https://symfony.com/doc/4.2/translation.html