symfony-cmf / menu-bundle

Extends the KnpMenuBundle to work with PHPCR ODM
https://cmf.symfony.com
32 stars 48 forks source link

translations missing #180

Closed ElectricMaxxx closed 10 years ago

ElectricMaxxx commented 10 years ago

for:

for the admin extension.

dbu commented 10 years ago

That extension lives in core and translations should come from core. Is it not working in the sandbox?

ElectricMaxxx commented 10 years ago

Right.

dbu commented 10 years ago

right as in its not needed and we close the issue, or right as in its not working and we need to investigate?

ElectricMaxxx commented 10 years ago

Yes. It occur in sandbox. And somebody should fix it as the keys only are visible. Would do it, when i have got better internet than now.

dbu commented 10 years ago

i can't reproduce that, works fine both in menu and content admins.

the only think that is weird is that we have show fields defined here but nowhere else, and miss the translations for those. i would propose to remove the configureShowField method as its inconsistent and not finished.

ElectricMaxxx commented 10 years ago

image

Maybe this would help a little bit.

dbu commented 10 years ago

ah, okay now i get it. it does not work when embedding the admin in a different admin. this is strange, it works when the menu is used standalone but not embedded. looks like something is killing the translation domains. might be a bug of SonataAdminBundle

dbu commented 10 years ago

@rande the screenshot comes from the PublishTimePeriodExtension that applies to the MenuNodeAdmin, which is used in the MenuNodeReferrersExtension as a sonata_type_collection. it seems at some point the translation domains get messed up. do you have an idea what goes wrong? i tried setting the domain on the individual fields in PublishTimePeriodExtension but that did not change anything.

rande commented 10 years ago

What is CmfCoreBundle the name of the catalogue for the current admin ?

dbu commented 10 years ago

CmfCoreBundle is the translation domain for the publish fields (those that fail to translate). the MenuNodeAdmin uses CmfMenuBundle, as does the MenuNodeReferrersExtension. all this is used in the StaticContentAdmin which uses CmfContentBundle as translation domain. (note i do not claim things would not be confusing ;-)

rande commented 10 years ago

So the translation domain is CmfMenuBundle, if you want to use a custom for a specific field you can set a translation_domain in the fieldDescription options field.

So the possible solution might be:

            ->add('publish_end_date', 'date', $dateOptions, array(
                'help' => 'form.help_publish_end_date',
                'translation_domain' => 'CmfCoreBundle'
            ))
dbu commented 10 years ago

but we set that domain - or do we lose it because groups get squashed? https://github.com/symfony-cmf/CoreBundle/blob/master/Admin/Extension/PublishTimePeriodExtension.php#L50

rande commented 10 years ago

I think the first group definition wins over later definition.

So this group configuration is useless.

Thomas Rabaix http://rabaix.net - http://sonata-project.org On Apr 15, 2014 4:39 PM, "David Buchmann" notifications@github.com wrote:

but we set that domain - or do we lose it because groups get squashed? https://github.com/symfony-cmf/CoreBundle/blob/master/Admin/Extension/PublishTimePeriodExtension.php#L50

— Reply to this email directly or view it on GitHubhttps://github.com/symfony-cmf/MenuBundle/issues/180#issuecomment-40489275 .

dbu commented 10 years ago

even if i add it to the field as you propose, it still does not work. in the same admin, we have the publish dates on the content directly, in the "Publish Workflow" tab, and there the fields are properly translated (whether i do it on the group or on the individual field).

i just verified with the translations of the Locale column that the translation comes from CmfMenuBundle. seems like the sonata_type_collection is forcing the translation domain of all fields instead of respecting individual translations.

dbu commented 10 years ago

rande pointed me to https://github.com/sonata-project/SonataDoctrinePhpcrAdminBundle/blob/master/Resources/views/CRUD/edit_phpcr_one_to_many.html.twig#L31 and indeed this is the source of the problem.

now i am stuck, because nested_field is a FormView instance. it does not provide the $fieldDescriptionOptions from the form mapper, only the options. i can move translation_domain one up into the form options and use that. but the group defaults go into the $fieldDescriptionOptions, so i am unsure what the right way to do this is.

$dateOptions['translation_domain'] = 'CmfCoreBundle';
....
        ->add('publish_end_date', 'date', $dateOptions, array(
            'help' => 'form.help_publish_end_date',
        ))

@rande should i change where i configure the translation domain?

dbu commented 10 years ago

@rande any input on this one?

dbu commented 10 years ago

fixed by https://github.com/sonata-project/SonataDoctrinePhpcrAdminBundle/pull/263 and https://github.com/symfony-cmf/CoreBundle/pull/140