public function translation(Request $request, $domain, $tr_locale)
{
$tr = ['domain' => $domain, 'locale' => $tr_locale];
// Get the translation data
$data = $this->getTranslationData($tr);
// Create the form
$form = $this->createFormBuilder(FormType::class, $data)->add('contents', TextareaType::class, ['constraints' => [new Assert\NotBlank(), new Assert\Length(['min' => 10])]])->getForm();
$form->handleRequest($request);
if ($form->isValid()) {
$data = $form->getData();
if ($response = $this->saveTranslationFile($data['contents'], $tr)) {
return $response;
}
}
$context = ['form' => $form->createView(), 'basename' => basename($tr['shortPath']), 'filetype' => 'yml', 'write_allowed' => $tr['writeallowed']];
return $this->render('@bolt/editlocale/editlocale.twig', $context);
}