Use translator inside Areabrick class?

How can i use the translator inside the Areabrick class? I want to translate the brick name and description. Couldn’t find something like this in the examples or docs.


<?php
// src/AppBundle/Document/Areabrick/Iframe.php

namespace AppBundle\Document\Areabrick;

use Pimcore\Extension\Document\Areabrick\AbstractTemplateAreabrick;

class Iframe extends AbstractTemplateAreabrick
{
    public function getName()
    {
        return 'IFrame';
    }

    public function getDescription()
    {
       # this should be parsed through the translator
       #  $this->translate() is not available 
       return 'Embed contents from other URL (websites) via iframe';
    }
}

Dependency Injection is the key word :wink:

@LeaveAirykson The name and description will be translated automatically. Go look under Settings > Admin Translations and you can translate them there.

1 Like

@aarongerig oh yeah, you’re right! No need for dependency injections. Thank you :+1: :slight_smile: