2011-11-23 16 views
5

sto cercando disattivare la cache traduttore in questo modo:Spegnere traduttore di cache

app/config/config.yml

 
    services: 
     translator.default: 
      class: %translator.class% 
      arguments: [ @service_container, @translator.selector, {}, { cache_dir: null, debug: %kernel.debug% }, @?session ] 

Il codice memorizzato nella cache nella cache/dev/appDevDebugProjectContainer.php dovrebbe essere: codice

 

    protected function getTranslator_DefaultService() 
    { 
     $this->services['translator.default'] = $instance = new \Symfony\Bundle\FrameworkBundle\Translation\Translator($this, new \Symfony\Component\Translation\MessageSelector(), array('translation.loader.php' => 'php', 'translation.loader.yml' => 'yml', 'translation.loader.xliff' => 'xliff'), array('cache_dir' => NULL, 'debug' => true), $this->get('session')); 

     ... resources ... 

     return $instance; 
    } 

ma ho seguito:

 

    protected function getTranslator_DefaultService() 
    { 
     return $this->services['translator.default'] = new \Symfony\Bundle\FrameworkBundle\Translation\Translator($this, new \Symfony\Component\Translation\MessageSelector(), array('translation.loader.db' => 'db', 'translation.loader.php' => 'php', 'translation.loader.yml' => 'yml', 'translation.loader.xliff' => 'xliff'), array('cache_dir' => NULL, 'debug' => true), $this->get('session')); 
    } 

Quindi le risorse del traduttore sono vuote.

+0

Avete risolto? Ho lo stesso problema .. –

+0

No, abbiamo cambiato framework in Silex. – constXife

risposta

-6

Un modo per farlo è:

Modifica symfony/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php e aggiungere un metodo:

public function setOption($option, $value) 
{ 
    $this->options[$option] = $value; 
} 

Nella tua AppKernel.php l'override un metodo:

public function boot() 
{ 
    parent::boot(); 
    $this->container->get('translator')->setOption('cache_dir', null); 
} 
+3

Non è consigliabile modificare i file principali. – CappY

+0

Devo parlarne con l'altro commentatore. Ad ogni aggiornamento del compositore perderai le tue modifiche –