Skip to content

Latest commit

 

History

History
39 lines (25 loc) · 1.2 KB

symfony-translation.md

File metadata and controls

39 lines (25 loc) · 1.2 KB

Symfony Translation integration

The symfony/translation library provides tools to internationalize your application.

Object Descriptor

The TranslationUsageDescriptor² is an object descriptor that uses translation to describe any usage object, delegating underlying objects description to the main descriptor.

Example :

<?php

use Yokai\SafeDelete\Usage\Descriptor\ObjectDescriptor;
use Yokai\SafeDelete\Usage\Descriptor\Adapter\Symfony\Translation\TranslationUsageDescriptor;

$descriptor = new ObjectDescriptor([
    new TranslationUsageDescriptor(
        $translator, // refer to symfony/translation documentation to know how to create a translator instance
        'deletion.usage.description' // let's say this is referring to "Object %subject% is used by %related%."
    )
]);

echo $descriptor->describe($usage); // "Object (subject description) is used by (related description)"

integrations jump to other adapters : symfony/property-access


« README