title: Zend framework 2 : How to set locale globaly?
body: <p>I have to change the locale dynamically depending which language the user wants.</p>
  
  <p>I can set the locale in the Application/Module.php like this :</p>
  
  <pre><code>public function onBootstrap(MvcEvent $e)
  {
      $translator = $e-&gt;getApplication()-&gt;getServiceManager()-&gt;get('translator');
      $translator-&gt;setLocale('hu_HU');
  }
  </code></pre>
  
  <p>But, how can I do this in the controller, if I want to change languages ? I tried this, but after this I can change the locale only for this one request and not global.</p>
  
  <pre><code>$translator = $this-&gt;getServiceLocator()-&gt;get('translator');
  $translator-&gt;setLocale('srb_SRB');
  </code></pre>