Controller/TranslationController.php
public function newAction(Request $request)
    {
        $handler = $this->get('lexik_translation.form.handler.trans_unit');

        $form = $this->createForm(TransUnitType::class, $handler->createFormData(), $handler->getFormOptions());

        if ($handler->process($form, $request)) {
            $message = $this->get('translator')->trans('translations.successfully_added', array(), 'LexikTranslationBundle');

            $this->get('session')->getFlashBag()->add('success', $message);

            $redirectUrl = $form->get('save_add')->isClicked() ? 'lexik_translation_new' : 'lexik_translation_grid';

            return $this->redirect($this->generateUrl($redirectUrl));
        }

        return $this->render('@LexikTranslation/Translation/new.html.twig', array(
            'layout' => $this->container->getParameter('lexik_translation.base_layout'),
            'form'   => $form->createView(),
        ));
    }
public function newAction(Request $request)
    {
        $handler = $this->get('lexik_translation.form.handler.trans_unit');

        $form = $this->createForm(TransUnitType::class, $handler->createFormData(), $handler->getFormOptions());

        if ($handler->process($form, $request)) {
            $message = $this->get('translator')->trans('translations.successfully_added', array(), 'LexikTranslationBundle');

            $this->get('session')->getFlashBag()->add('success', $message);

            $redirectUrl = $form->get('save_add')->isClicked() ? 'lexik_translation_new' : 'lexik_translation_grid';

            return $this->redirect($this->generateUrl($redirectUrl));
        }

        return $this->render('@LexikTranslation/Translation/new.html.twig', array(
            'layout' => $this->container->getParameter('lexik_translation.base_layout'),
            'form'   => $form->createView(),
        ));
    }
public function newAction ( Request $ request ) { $ handler = $ this -> get ( 'lexik_translation.form.handler.trans_unit' ) ; $ form = $ this -> createForm ( TransUnitType :: class , $ handler -> createFormData ( ) , $ handler -> getFormOptions ( ) ) ; if ( $ handler -> process ( $ form , $ request ) ) { $ message = $ this -> get ( 'translator' ) -> trans ( 'translations.successfully_added' , array ( ) , 'LexikTranslationBundle' ) ; $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'success' , $ message ) ; $ redirectUrl = $ form -> get ( 'save_add' ) -> isClicked ( ) ? 'lexik_translation_new' : 'lexik_translation_grid' ; return $ this -> redirect ( $ this -> generateUrl ( $ redirectUrl ) ) ; } return $ this -> render ( '@LexikTranslation/Translation/new.html.twig' , array ( 'layout' => $ this -> container -> getParameter ( 'lexik_translation.base_layout' ) , 'form' => $ form -> createView ( ) , ) ) ; }
Add a new trans unit with translation for managed locales.

@return \Symfony\Component\HttpFoundation\Response
Add a new trans unit with translation for managed locales .