app\extensions\route \ Localized

Localized Route

Download |
| Newest | Edit
<?php

namespace app\extensions\route;

use \lithium\core\Environment;

class Localized extends \lithium\net\http\Route {

    protected function _init() { 
        $this->_config['template'] = '/{:locale:[a-z]{2}}' . $this->_config['template'];
        $this->_config['params'] += array('locale' => null);
        parent::_init();
    }

    public function match(array $options = array(), $context = null) { 
        $locale = Environment::get('locale');
        return parent::match($options + compact('locale'), $context);
    }
}
?>

Description

A route class which prefixes the URL with the locale allowing for parsing the locale later from the URL. Also persists the current locale.

Details

  • Version: 1
  • Created: 2010-04-29 02:52:42
  • File: app/extensions/route/Localized.php

Maintainers