src/CoreBundle/EventListener/DcGeneral/EnvironmentPopulator/TranslatorPopulator.php
protected function populate(EnvironmentInterface $environment)
    {
        $translator = $environment->getTranslator();
        if (!($translator instanceof TranslatorChain)) {
            $translatorChain = new TranslatorChain();
            $translatorChain->add($translator);
            $environment->setTranslator($translatorChain);
        } else {
            $translatorChain = $translator;
        }
        $translatorChain->add($translator = new StaticTranslator());

        // Map the tl_metamodel_item domain over to this domain.
        $this->dispatcher->dispatch(
            ContaoEvents::SYSTEM_LOAD_LANGUAGE_FILE,
            new LoadLanguageFileEvent('tl_metamodel_item')
        );

        $definitionName = $environment->getDataDefinition()->getName();
        $this->mapTranslations(
            $GLOBALS['TL_LANG']['tl_metamodel_item'],
            $definitionName,
            $translator
        );
        if (null === $inputScreen = $this->viewCombination->getScreen($definitionName)) {
            return;
        }

        $this->addInputScreenTranslations(
            $translator,
            $inputScreen,
            $definitionName
        );
    }
protected function populate(EnvironmentInterface $environment)
    {
        $translator = $environment->getTranslator();
        if (!($translator instanceof TranslatorChain)) {
            $translatorChain = new TranslatorChain();
            $translatorChain->add($translator);
            $environment->setTranslator($translatorChain);
        } else {
            $translatorChain = $translator;
        }
        $translatorChain->add($translator = new StaticTranslator());

        // Map the tl_metamodel_item domain over to this domain.
        $this->dispatcher->dispatch(
            ContaoEvents::SYSTEM_LOAD_LANGUAGE_FILE,
            new LoadLanguageFileEvent('tl_metamodel_item')
        );

        $definitionName = $environment->getDataDefinition()->getName();
        $this->mapTranslations(
            $GLOBALS['TL_LANG']['tl_metamodel_item'],
            $definitionName,
            $translator
        );
        if (null === $inputScreen = $this->viewCombination->getScreen($definitionName)) {
            return;
        }

        $this->addInputScreenTranslations(
            $translator,
            $inputScreen,
            $definitionName
        );
    }
Populate the environment.

@param EnvironmentInterface $environment The environment.

@return void

@SuppressWarnings(PHPMD.Superglobals)
@SuppressWarnings(PHPMD.CamelCaseVariableName)