Skip to content

Commit

Permalink
added translation keys for sonata
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Cabot committed Feb 5, 2015
1 parent 4033533 commit 02c4d0f
Show file tree
Hide file tree
Showing 14 changed files with 175 additions and 8 deletions.
12 changes: 10 additions & 2 deletions Admin/EmailAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper;

/**
Expand All @@ -32,6 +33,14 @@ public function setLocale($locale)
$this->locale = $locale;
}

/**
* {@inheritdoc}
*/
protected function configureRoutes(RouteCollection $collection)
{
$collection->remove('show');
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -87,7 +96,6 @@ protected function configureListFields(ListMapper $listMapper)
'actions',
[
'actions' => [
'show' => [],
'edit' => [],
'delete' => [],
]
Expand Down Expand Up @@ -129,7 +137,7 @@ protected function configureTabMenu(MenuItemInterface $menu, $action, AdminInter
]);
}

$menu->addChild('NEW', [
$menu->addChild($this->trans('create_translation'), [
'route' => 'admin_lexik_mailer_email_emailtranslation_create',
'routeParameters' => [
'id' => $id
Expand Down
12 changes: 10 additions & 2 deletions Admin/LayoutAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Show\ShowMapper;

/**
Expand All @@ -32,6 +33,14 @@ public function setLocale($locale)
$this->locale = $locale;
}

/**
* {@inheritdoc}
*/
protected function configureRoutes(RouteCollection $collection)
{
$collection->remove('show');
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -67,7 +76,6 @@ protected function configureListFields(ListMapper $listMapper)
'actions',
[
'actions' => [
'show' => [],
'edit' => [],
'delete' => [],
]
Expand Down Expand Up @@ -107,7 +115,7 @@ protected function configureTabMenu(MenuItemInterface $menu, $action, AdminInter
]);
}

$menu->addChild('NEW', [
$menu->addChild($this->trans('create_translation'), [
'route' => 'admin_lexik_mailer_layout_layouttranslation_create',
'routeParameters' => [
'id' => $id
Expand Down
8 changes: 8 additions & 0 deletions Entity/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ public function __construct()
$this->headers = array();
}

/**
* @return string
*/
public function __toString()
{
return $this->reference;
}

/**
* Get id
*
Expand Down
8 changes: 8 additions & 0 deletions Entity/EmailTranslation.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ public function __construct($lang = null)
$this->updatedAt = new \DateTime();
}

/**
* @return string
*/
public function __toString()
{
return $this->lang;
}

/**
* @ORM\PreUpdate()
*/
Expand Down
8 changes: 8 additions & 0 deletions Entity/LayoutTranslation.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ public function __construct($lang = null)
$this->updatedAt = new \DateTime();
}

/**
* @return string
*/
public function __toString()
{
return $this->lang;
}

/**
* @ORM\PreUpdate()
*/
Expand Down
20 changes: 16 additions & 4 deletions Resources/config/sonata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<services>
<!-- LAYOUT ADMIN -->
<service id="lexik_mailer.admin.layout" class="%lexik_mailer.admin.layout.class%">
<tag name="sonata.admin" manager_type="orm" group="Emails" label="Layouts" />
<tag name="sonata.admin" manager_type="orm" group="Emails" label="Layouts" label_translator_strategy="sonata.admin.label.strategy.underscore" />
<argument/>
<argument>Lexik\Bundle\MailerBundle\Entity\Layout</argument>
<argument></argument>
Expand All @@ -24,16 +24,22 @@
<call method="setLocale">
<argument>%locale%</argument>
</call>
<call method="setTranslationDomain">
<argument>LayoutAdmin</argument>
</call>
</service>
<service id="lexik_mailer.admin.layout_translation" class="%lexik_mailer.admin.layout_translation.class%">
<tag name="sonata.admin" manager_type="orm" group="Autre" label="Layouts Translations" />
<tag name="sonata.admin" manager_type="orm" group="Autre" label="Layouts Translations" label_translator_strategy="sonata.admin.label.strategy.underscore" />
<argument/>
<argument>Lexik\Bundle\MailerBundle\Entity\LayoutTranslation</argument>
<argument></argument>
<call method="setTranslationDomain">
<argument>LayoutTranslationAdmin</argument>
</call>
</service>
<!-- EMAIL ADMIN -->
<service id="lexik_mailer.admin.email" class="%lexik_mailer.admin.email.class%">
<tag name="sonata.admin" manager_type="orm" group="Emails" label="Emails" />
<tag name="sonata.admin" manager_type="orm" group="Emails" label="Emails" label_translator_strategy="sonata.admin.label.strategy.underscore" />
<argument/>
<argument>Lexik\Bundle\MailerBundle\Entity\Email</argument>
<argument></argument>
Expand All @@ -43,12 +49,18 @@
<call method="setLocale">
<argument>%locale%</argument>
</call>
<call method="setTranslationDomain">
<argument>EmailAdmin</argument>
</call>
</service>
<service id="lexik_mailer.admin.email_translation" class="%lexik_mailer.admin.email_translation.class%">
<tag name="sonata.admin" manager_type="orm" group="Autre" label="Emails Translations" />
<tag name="sonata.admin" manager_type="orm" group="Autre" label="Emails Translations" label_translator_strategy="sonata.admin.label.strategy.underscore" />
<argument/>
<argument>Lexik\Bundle\MailerBundle\Entity\EmailTranslation</argument>
<argument></argument>
<call method="setTranslationDomain">
<argument>EmailTranslationAdmin</argument>
</call>
</service>
</services>
</container>
21 changes: 21 additions & 0 deletions Resources/translations/EmailAdmin.en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
list:
label_reference: Reference
label_layout: Layout
label_description: Description
label__action: Action

filter:
label_reference: Reference
label_layout: Layout

breadcrumb:
link_email_list: Emails

form:
label_layout: Layout
label_description: Description
label_reference: Reference
label_bcc: BCC
label_spool: Spool

create_translation: New translation
21 changes: 21 additions & 0 deletions Resources/translations/EmailAdmin.fr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
list:
label_reference: Référence
label_layout: Layout
label_description: Description
label__action: Action

filter:
label_reference: Référence
label_layout: Layout

breadcrumb:
link_email_list: Emails

form:
label_layout: Layout
label_description: Description
label_reference: Référence
label_bcc: Copie Cachée
label_spool: Spool

create_translation: Nouvelle traduction
11 changes: 11 additions & 0 deletions Resources/translations/EmailTranslationAdmin.en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
breadcrumb:
link_email_translation_list: Translations
link_email_translation_create: New

form:
label_lang: Language
label_from_address: From address
label_from_name: From name
label_subject: Subject
label_body : Content (html)
label_body_text: Content (plain text)
11 changes: 11 additions & 0 deletions Resources/translations/EmailTranslationAdmin.fr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
breadcrumb:
link_email_translation_list: Traductions
link_email_translation_create: Nouvelle

form:
label_lang: Langue
label_from_address: Expéditeur (adresse)
label_from_name: Expéditeur (nom)
label_subject: Sujet
label_body : Contenu (html)
label_body_text: Contenu (texte)
18 changes: 18 additions & 0 deletions Resources/translations/LayoutAdmin.en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
list:
label_reference: Reference
label_description: Description
label__action: Action

filter:
label_reference: Reference

breadcrumb:
link_layout_list: Layouts

form:
label_description: Description
label_reference: Reference
label_bcc: BCC
label_spool: Spool

create_translation: New translation
19 changes: 19 additions & 0 deletions Resources/translations/LayoutAdmin.fr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
list:
label_reference: Référence
label_description: Description
label__action: Action

filter:
label_reference: Référence

breadcrumb:
link_layout_list: Layouts

form:
label_description: Description
label_reference: Référence
label_bcc: Copie Cachée
label_languages: Langues
label_spool: Spool

create_translation: Nouvelle traduction
7 changes: 7 additions & 0 deletions Resources/translations/LayoutTranslationAdmin.en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
breadcrumb:
link_layout_translation_list: Translations
link_layout_translation_create: New

form:
label_lang: Language
label_body: Content
7 changes: 7 additions & 0 deletions Resources/translations/LayoutTranslationAdmin.fr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
breadcrumb:
link_layout_translation_list: Traductions
link_layout_translation_create: Nouvelle

form:
label_lang: Langue
label_body: Contenu

0 comments on commit 02c4d0f

Please sign in to comment.