mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
add translations
This commit is contained in:
parent
5a61f05faa
commit
b120e47786
@ -32,22 +32,23 @@ class AdminDocGeneratorTemplateController extends CRUDController
|
||||
switch ($action) {
|
||||
case 'new':
|
||||
$context = $this->contextManager->getContextByKey($request->get('context'));
|
||||
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
$context = $this->contextManager->getContextByDocGeneratorTemplate($entity);
|
||||
|
||||
break;
|
||||
return array_merge(
|
||||
$defaultTemplateParameters,
|
||||
['context' => $context]
|
||||
);
|
||||
case 'index':
|
||||
return array_merge(
|
||||
$defaultTemplateParameters,
|
||||
['contextManager' => $this->contextManager]
|
||||
);
|
||||
|
||||
default:
|
||||
return parent::generateTemplateParameter($action, $entity, $request, $defaultTemplateParameters); // TODO: Change the autogenerated stub
|
||||
}
|
||||
|
||||
return array_merge(
|
||||
$defaultTemplateParameters,
|
||||
['context' => $context]
|
||||
);
|
||||
}
|
||||
|
||||
public function new(Request $request): Response
|
||||
|
42
src/Bundle/ChillDocGeneratorBundle/Menu/AdminMenuBuilder.php
Normal file
42
src/Bundle/ChillDocGeneratorBundle/Menu/AdminMenuBuilder.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\DocGeneratorBundle\Menu;
|
||||
|
||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
private Security $security;
|
||||
|
||||
public function __construct(TranslatorInterface $translator, Security $security)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
$this->security = $security;
|
||||
}
|
||||
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||
{
|
||||
if ($this->security->isGranted('ROLE_ADMIN')) {
|
||||
if (in_array($menuId, ['admin_index', 'admin_section'])) {
|
||||
$menu->addChild($this->translator->trans('docgen.Document generation'), [
|
||||
'route' => 'chill_crud_docgen_template_index'
|
||||
])->setExtras([
|
||||
'order' => 350,
|
||||
'explain' => 'docgen.Manage templates and document generation'
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function getMenuIds(): array
|
||||
{
|
||||
return ['admin_index', 'admin_section', ['docgen_admin']];
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -5,6 +5,7 @@
|
||||
{% block table_entities_thead_tr %}
|
||||
<th></th>
|
||||
<th>{{ 'Title'|trans }}</th>
|
||||
<th>{{ 'docgen.Context'|trans }}</th>
|
||||
<th>{{ 'Edit'|trans }}</th>
|
||||
{% endblock %}
|
||||
|
||||
@ -13,6 +14,7 @@
|
||||
<tr>
|
||||
<td>{{ entity.id }}</td>
|
||||
<td>{{ entity.name | localize_translatable_string }}</td>
|
||||
<td>{{ contextManager.getContextByKey(entity.context).name|trans }}</td>
|
||||
<td>
|
||||
<a href="{{ chill_path_add_return_path('chill_crud_docgen_template_edit', { 'id': entity.id }) }}" class="btn btn-edit">
|
||||
{{ 'Edit'|trans }}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% extends '@ChillDocGenerator/Admin/layout.html.twig' %}
|
||||
|
||||
{% block title 'Pick template context'|trans %}
|
||||
{% block title 'docgen.Pick template context'|trans %}
|
||||
|
||||
{% block layout_wvm_content %}
|
||||
<div class="col-md-10 col-xxl">
|
||||
|
@ -9,6 +9,11 @@ services:
|
||||
autoconfigure: true
|
||||
resource: '../Repository/'
|
||||
|
||||
Chill\DocGeneratorBundle\Menu\:
|
||||
autoconfigure: true
|
||||
autowire: true
|
||||
resource: '../Menu/'
|
||||
|
||||
Chill\DocGeneratorBundle\Serializer\Normalizer\:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
|
@ -1,3 +1,19 @@
|
||||
docgen:
|
||||
Generate a document: Génerer un document
|
||||
Generate: Génerer
|
||||
Document generation: Génération de documents
|
||||
Manage templates and document generation: Gestion des documents générés et de leurs gabarits
|
||||
Pick template context: Choisir un contexte
|
||||
Context: Contexte
|
||||
New template: Nouveau gabarit
|
||||
Edit template: Modifier gabarit
|
||||
With context: 'Avec le contexte :'
|
||||
|
||||
|
||||
crud:
|
||||
docgen_template:
|
||||
index:
|
||||
title: Génération de documents
|
||||
add_new: Créer
|
||||
|
||||
|
||||
|
@ -102,7 +102,7 @@ class AccompanyingPeriodContext implements
|
||||
$builder
|
||||
->add('mainPerson', CheckboxType::class, [
|
||||
'required' => false,
|
||||
'label' => 'Ask for main person',
|
||||
'label' => 'docgen.Ask for main person',
|
||||
])
|
||||
->add('mainPersonLabel', TextType::class, [
|
||||
'label' => 'main person label',
|
||||
@ -110,7 +110,7 @@ class AccompanyingPeriodContext implements
|
||||
])
|
||||
->add('person1', CheckboxType::class, [
|
||||
'required' => false,
|
||||
'label' => 'Ask for person 1',
|
||||
'label' => 'docgen.Ask for person 1',
|
||||
])
|
||||
->add('person1Label', TextType::class, [
|
||||
'label' => 'person 1 label',
|
||||
@ -118,7 +118,7 @@ class AccompanyingPeriodContext implements
|
||||
])
|
||||
->add('person2', CheckboxType::class, [
|
||||
'required' => false,
|
||||
'label' => 'Ask for person 2',
|
||||
'label' => 'docgen.Ask for person 2',
|
||||
])
|
||||
->add('person2Label', TextType::class, [
|
||||
'label' => 'person 2 label',
|
||||
@ -182,7 +182,7 @@ class AccompanyingPeriodContext implements
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'A basic context for accompanying period';
|
||||
return 'docgen.A basic context for accompanying period';
|
||||
}
|
||||
|
||||
public function getEntityClass(): string
|
||||
|
@ -79,7 +79,7 @@ class AccompanyingPeriodWorkContext implements
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'A context for work';
|
||||
return 'docgen.A context for accompanying period work';
|
||||
}
|
||||
|
||||
public function getEntityClass(): string
|
||||
|
@ -127,7 +127,7 @@ class AccompanyingPeriodWorkEvaluationContext implements
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Context for accompanying period work';
|
||||
return 'docgen.A context for accompanying period work evaluation';
|
||||
}
|
||||
|
||||
public function getEntityClass(): string
|
||||
|
@ -457,4 +457,11 @@ see persons associated: Voir les usagers concernés
|
||||
docgen:
|
||||
Main person: Personne principale
|
||||
person 1: Première personne
|
||||
person 2: Deuxième personne
|
||||
person 2: Seconde personne
|
||||
Ask for main person: Demander à l'utilisateur de préciser la personne principale
|
||||
Ask for person 1: Demander à l'utilisateur de préciser la première personne
|
||||
Ask for person 2: Demander à l'utilisateur de préciser la seconde personne
|
||||
Accompanying period work: Actions
|
||||
A basic context for accompanying period: Contexte pour les parcours
|
||||
A context for accompanying period work: Contexte pour les actions d'accompagnement
|
||||
A context for accompanying period work evaluation: Contexte pour les évaluations dans les actions d'accompagnement
|
||||
|
Loading…
x
Reference in New Issue
Block a user