php - Change web app locale with url routing -


i'm developing web app zend framework 2.

how can change application locale based on current url?

i match urls domain/locale/controller/action/etc. don't know put code analyse current url , change locale accordingly!

thanks help!

i solved in way:

../config/autoload/local.php  $_server['request_uri_path'] = parse_url($_server['request_uri'], php_url_path); $segment = explode('/', $_server['request_uri_path']); $locale = $segment[1];  if($locale == '')     $locale = 'en_us'; // default locale  return array(      'translator' => array(          'locale' => $locale,          ), ); 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -