Skip to content

Commit

Permalink
Added translation to block services
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 authored and greg0ire committed Dec 2, 2017
1 parent e5ea807 commit 33c9539
Show file tree
Hide file tree
Showing 9 changed files with 288 additions and 26 deletions.
19 changes: 15 additions & 4 deletions src/Block/Service/ContainerBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,22 @@ public function buildEditForm(FormMapper $formMapper, BlockInterface $block)

$formMapper->add('settings', 'sonata_type_immutable_array', [
'keys' => [
['code', 'text', ['required' => false]],
['layout', 'textarea', []],
['class', 'text', ['required' => false]],
['template', 'sonata_type_container_template_choice', []],
['code', 'text', [
'required' => false,
'label' => 'form.label_code',
]],
['layout', 'textarea', [
'label' => 'form.label_layout',
]],
['class', 'text', [
'required' => false,
'label' => 'form.label_class',
]],
['template', 'sonata_type_container_template_choice', [
'label' => 'form.label_template',
]],
],
'translation_domain' => 'SonataBlockBundle',
]);

$formMapper->add('children', 'sonata_type_collection', [], [
Expand Down
47 changes: 38 additions & 9 deletions src/Block/Service/MenuBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public function buildEditForm(FormMapper $form, BlockInterface $block)
{
$form->add('settings', 'sonata_type_immutable_array', [
'keys' => $this->getFormSettingsKeys(),
'translation_domain' => 'SonataBlockBundle',
]);
}

Expand Down Expand Up @@ -162,6 +163,7 @@ protected function getFormSettingsKeys()
{
$choiceOptions = [
'required' => false,
'label' => 'form.label_url',
'choice_translation_domain' => 'SonataBlockBundle',
];

Expand All @@ -173,16 +175,43 @@ protected function getFormSettingsKeys()
$choiceOptions['choices'] = array_flip($this->menuRegistry->getAliasNames());

return [
['title', 'text', ['required' => false]],
['cache_policy', 'choice', ['choices' => ['public', 'private']]],
['title', 'text', [
'required' => false,
'label' => 'form.label_title',
]],
['cache_policy', 'choice', [
'label' => 'form.label_cache_policy',
'choices' => ['public', 'private'],
]],
['menu_name', 'choice', $choiceOptions],
['safe_labels', 'checkbox', ['required' => false]],
['current_class', 'text', ['required' => false]],
['first_class', 'text', ['required' => false]],
['last_class', 'text', ['required' => false]],
['menu_class', 'text', ['required' => false]],
['children_class', 'text', ['required' => false]],
['menu_template', 'text', ['required' => false]],
['safe_labels', 'checkbox', [
'required' => false,
'label' => 'form.label_safe_labels',
]],
['current_class', 'text', [
'required' => false,
'label' => 'form.label_current_class',
]],
['first_class', 'text', [
'required' => false,
'label' => 'form.label_first_class',
]],
['last_class', 'text', [
'required' => false,
'label' => 'form.label_last_class',
]],
['menu_class', 'text', [
'required' => false,
'label' => 'form.label_menu_class',
]],
['children_class', 'text', [
'required' => false,
'label' => 'form.label_children_class',
]],
['menu_template', 'text', [
'required' => false,
'label' => 'form.label_menu_template',
]],
];
}

Expand Down
11 changes: 9 additions & 2 deletions src/Block/Service/RssBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,16 @@ public function buildEditForm(FormMapper $formMapper, BlockInterface $block)
{
$formMapper->add('settings', 'sonata_type_immutable_array', [
'keys' => [
['url', 'url', ['required' => false]],
['title', 'text', ['required' => false]],
['url', 'url', [
'required' => false,
'label' => 'form.label_url',
]],
['title', 'text', [
'required' => false,
'label' => 'form.label_title',
]],
],
'translation_domain' => 'SonataBlockBundle',
]);
}

Expand Down
5 changes: 4 additions & 1 deletion src/Block/Service/TemplateBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ public function buildEditForm(FormMapper $formMapper, BlockInterface $block)
{
$formMapper->add('settings', 'sonata_type_immutable_array', [
'keys' => [
['template', null, []],
['template', null, [
'label' => 'form.label_template',
]],
],
'translation_domain' => 'SonataBlockBundle',
]);
}

Expand Down
5 changes: 4 additions & 1 deletion src/Block/Service/TextBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ public function buildEditForm(FormMapper $formMapper, BlockInterface $block)
{
$formMapper->add('settings', 'sonata_type_immutable_array', [
'keys' => [
['content', 'textarea', []],
['content', 'textarea', [
'label' => 'form.label_content',
]],
],
'translation_domain' => 'SonataBlockBundle',
]);
}

Expand Down
60 changes: 60 additions & 0 deletions src/Resources/translations/SonataBlockBundle.de.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,66 @@
<source>sonata.block.template</source>
<target>Template</target>
</trans-unit>
<trans-unit id="form.label_template">
<source>form.label_template</source>
<target>Template</target>
</trans-unit>
<trans-unit id="form.label_content">
<source>form.label_content</source>
<target>Inhalt</target>
</trans-unit>
<trans-unit id="form.label_url">
<source>form.label_url</source>
<target>URL</target>
</trans-unit>
<trans-unit id="form.label_title">
<source>form.label_title</source>
<target>Titel</target>
</trans-unit>
<trans-unit id="form.label_code">
<source>form.label_code</source>
<target>Code</target>
</trans-unit>
<trans-unit id="form.label_layout">
<source>form.label_layout</source>
<target>Layout</target>
</trans-unit>
<trans-unit id="form.label_class">
<source>form.label_class</source>
<target>CSS Klasse</target>
</trans-unit>
<trans-unit id="form.label_cache_policy">
<source>form.label_cache_policy</source>
<target>Cache Policy</target>
</trans-unit>
<trans-unit id="form.label_safe_labels">
<source>form.label_safe_labels</source>
<target>Sichere Bezeichner</target>
</trans-unit>
<trans-unit id="form.label_current_class">
<source>form.label_current_class</source>
<target>Aktuelle CSS Klasse</target>
</trans-unit>
<trans-unit id="form.label_first_class">
<source>form.label_first_class</source>
<target>Erste CSS Klasse</target>
</trans-unit>
<trans-unit id="form.label_last_class">
<source>form.label_last_class</source>
<target>Letzte CSS Klasse</target>
</trans-unit>
<trans-unit id="form.label_menu_class">
<source>form.label_menu_class</source>
<target>Menu CSS Klasse</target>
</trans-unit>
<trans-unit id="form.label_children_class">
<source>form.label_children_class</source>
<target>Children CSS Klasse</target>
</trans-unit>
<trans-unit id="form.label_menu_template">
<source>form.label_menu_template</source>
<target>Menü Template</target>
</trans-unit>
</body>
</file>
</xliff>
60 changes: 60 additions & 0 deletions src/Resources/translations/SonataBlockBundle.en.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,66 @@
<source>sonata.block.template</source>
<target>Template</target>
</trans-unit>
<trans-unit id="form.label_template">
<source>form.label_template</source>
<target>Template</target>
</trans-unit>
<trans-unit id="form.label_content">
<source>form.label_content</source>
<target>Content</target>
</trans-unit>
<trans-unit id="form.label_url">
<source>form.label_url</source>
<target>URL</target>
</trans-unit>
<trans-unit id="form.label_title">
<source>form.label_title</source>
<target>Title</target>
</trans-unit>
<trans-unit id="form.label_code">
<source>form.label_code</source>
<target>Code</target>
</trans-unit>
<trans-unit id="form.label_layout">
<source>form.label_layout</source>
<target>Layout</target>
</trans-unit>
<trans-unit id="form.label_class">
<source>form.label_class</source>
<target>CSS Class</target>
</trans-unit>
<trans-unit id="form.label_cache_policy">
<source>form.label_cache_policy</source>
<target>Cache policy</target>
</trans-unit>
<trans-unit id="form.label_safe_labels">
<source>form.label_safe_labels</source>
<target>Safe labels</target>
</trans-unit>
<trans-unit id="form.label_current_class">
<source>form.label_current_class</source>
<target>Current CSS Class</target>
</trans-unit>
<trans-unit id="form.label_first_class">
<source>form.label_first_class</source>
<target>First CSS Class</target>
</trans-unit>
<trans-unit id="form.label_last_class">
<source>form.label_last_class</source>
<target>Last CSS Class</target>
</trans-unit>
<trans-unit id="form.label_menu_class">
<source>form.label_menu_class</source>
<target>Menu CSS Class</target>
</trans-unit>
<trans-unit id="form.label_children_class">
<source>form.label_children_class</source>
<target>Children CSS Class</target>
</trans-unit>
<trans-unit id="form.label_menu_template">
<source>form.label_menu_template</source>
<target>Menu Template</target>
</trans-unit>
</body>
</file>
</xliff>
60 changes: 60 additions & 0 deletions src/Resources/translations/SonataBlockBundle.fr.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,66 @@
<source>sonata.block.template</source>
<target>Vue Partielle</target>
</trans-unit>
<trans-unit id="form.label_template">
<source>form.label_template</source>
<target>Template</target>
</trans-unit>
<trans-unit id="form.label_content">
<source>form.label_content</source>
<target>Contenu</target>
</trans-unit>
<trans-unit id="form.label_url">
<source>form.label_url</source>
<target>URL</target>
</trans-unit>
<trans-unit id="form.label_title">
<source>form.label_title</source>
<target>Titre</target>
</trans-unit>
<trans-unit id="form.label_code">
<source>form.label_code</source>
<target>Code</target>
</trans-unit>
<trans-unit id="form.label_layout">
<source>form.label_layout</source>
<target>Layout</target>
</trans-unit>
<trans-unit id="form.label_class">
<source>form.label_class</source>
<target>Classe CSS</target>
</trans-unit>
<trans-unit id="form.label_cache_policy">
<source>form.label_cache_policy</source>
<target>Cache Policy</target>
</trans-unit>
<trans-unit id="form.label_safe_labels">
<source>form.label_safe_labels</source>
<target>Libellés sûrs</target>
</trans-unit>
<trans-unit id="form.label_current_class">
<source>form.label_current_class</source>
<target>Classe CSS de l'élément actuel du menu</target>
</trans-unit>
<trans-unit id="form.label_first_class">
<source>form.label_first_class</source>
<target>Classe CSS du premier élément du menu</target>
</trans-unit>
<trans-unit id="form.label_last_class">
<source>form.label_last_class</source>
<target>Classe CSS du dernier élément du menu</target>
</trans-unit>
<trans-unit id="form.label_menu_class">
<source>form.label_menu_class</source>
<target>Classe CSS du menu</target>
</trans-unit>
<trans-unit id="form.label_children_class">
<source>form.label_children_class</source>
<target>Classe CSS des sous-menus</target>
</trans-unit>
<trans-unit id="form.label_menu_template">
<source>form.label_menu_template</source>
<target>Template du menu</target>
</trans-unit>
</body>
</file>
</xliff>

0 comments on commit 33c9539

Please sign in to comment.