set _locale manual by function

72 views Asked by At

I am trying to get "Handling the User's locale" working, where its said, that "It is also possible to store the locale in the session instead of on a per request basis. If you do this, each subsequent request will have this locale." by

$this->get('session')->set('_locale', 'en_US');

I have a translation file named messages.zh.yml in my Resources/ translations folder. and a Function which set the locale:

public function languageAction($l) {

    $this->get('session')->set('_locale', $l);    

    return $this->redirect($this->generateUrl('orders'));

}

the parameter is the language value, in my case "zh"

But when i call this function in my symfony project there is no translation on my website. But the Profiler in my develope version says, that the _locale session is set to "zh", so why is there no translation at all?

0

There are 0 answers