Labels in Sonata Admin Bundle

前端 未结 2 1409
一生所求
一生所求 2020-12-28 19:04

I have started new with the sonata admin bundle. its very handy and easy to setup and use , but i can\'t seem to get the translation fixed for the default labels

e.

2条回答
  •  臣服心动
    2020-12-28 19:32

    for translate menu and forms override file: SonataAdminBundle.[your_language].xliff(with content from: vendor/sonata-project/admin-bundle/Sonata/AdminBundle/Resources/translations/SonataAdminBundle.[your_language].xliff), put file in:

    app/Resource/SonataAdminBundle/translations/
    

    full path:

    app/Resource/SonataAdminBundle/translations/SonataAdminBundle.[your_language].xliff
    

    If you want to translate your labels for field, you must create translate file in your bundle, for example:

    src/YourAlias/YourNameOfBundle/Resources/translations/YourAliasYourNameOfBundle.[your_language].xliff
    

    if your Admin class is in

    src/YourAlias/YourNameOfBundle/Admin/YourClassAdmin.php
    

    Sonata use FOSUserBundle and if you want change translation for users module, you must ovverride file: FOSUserBundle.[your_language].yml in:

    app/Resource/FOSUSerBundle/translations/FOSUserBundle.[your_language].yml
    

    and analogously for SonataUserBundle

    I use that configuration and everything works!

提交回复
热议问题