This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Sonata Admin label translation

Discuss Symfony 2 bundles here

Sonata Admin label translation

by philippd » Tue Apr 21, 2015 1:10 pm

Hello there,


I would like to translate groups and labels on my Sonata Admin Dashboard as shown in https://sonata-project.org/bundles/admi ... board.html

It says that you can do it like this:

Code: Select all
services:
    sonata.admin.post:
        class: Acme\DemoBundle\Admin\PostAdmin
        tags:
            - name: sonata.admin
              manager_type: orm
              group: "acme.admin.group.content"
              label: "acme.admin.model.post"
              label_catalogue: "AcmeDemoBundle"
        arguments:
            - ~
            - Acme\DemoBundle\Entity\Post
            - ~



In my Code it actually looks like this:

Code: Select all
services:
    sonata.admin.event:
        class: EventManager\EventBundle\Admin\EventAdmin
        tags:
            - { name: sonata.admin, manager_type: orm, group: "admin.group.events", label: "admin.label.events", label_catalogue: "EventManagerMsg" }
        arguments:
            - ~
            - EventManager\EventBundle\Entity\Event
            - ~
        calls:
            - [ setTranslationDomain, [EventManagerEventBundle]]


In my budle there is a EventManagerMsg.en.yml and EventManagerMsg.de.yml and in both files there are transaltions for the keys admin.group.events and admin.label.events

When accessing the Dashboard the group key admin.group.events is successfully translated while the label key admin.label.events is not translated.


Have you got an idea why label is actually not translated?

The result looks like this: https://dl.dropboxusercontent.com/u/269 ... roblem.jpg

I guess its something easy as I am new to Symfony and Sonata Admin and just trying to do my first steps there


Best,
Philipp
philippd
Junior Member
 
Posts: 14
Joined: Wed Dec 21, 2011 7:59 pm
Location: Hamburg, Germany

Re: Sonata Admin label translation

by philippd » Tue Apr 21, 2015 1:19 pm

just when reading the post I figured out that

- [ setTranslationDomain, [EventManagerMsg]]


was set to the wrong TranslationDomain. I just focused on the label_catalogue propertie :roll:
Strange indeed that it worked for the groups but not for the labels.
philippd
Junior Member
 
Posts: 14
Joined: Wed Dec 21, 2011 7:59 pm
Location: Hamburg, Germany