简体   繁体   中英

Sonata Admin Bundle translation

I am setting translation of sonataadminbundle according this article

I have done like this

made Acme/AdminBundle/Resources/translations/messages.ja.yml

form:
    name: 名前

in Acme/Adminbundle/Admin/ImgAdmin.php

class ImgAdmin extends Admin
{
    protected $translationDomain = 'messages';

   public function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->addIdentifier('id')     
            ->add('name',null,array('label'=> 'form.name'))

in config.yml

framework:
    translator:      { fallback: ja }

then I have cache cleared.

However translation doesn't work.

Is there anything I have to do??

Did you empty the cache with the command line tool? I've found that I need to empty the cache completely with rm -rf app/cache/* (or the specific environments) for new translations to show up as expected.

You're probably not looking for an answer anymore, but just for reference: I just had the same issue and noticed that in config.yml , I still had somewhere:

parameters:
    locale: en

So in your case, it could still be looking for a messages.en.yml that doesn't exist.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM