Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class MultiLingual extends ModelAsController {
- static $lang;
- function init() {
- $baseUrl = Director::baseUrl();
- $requestUri = $_SERVER['REQUEST_URI'];
- $lang = substr($requestUri, strlen($baseUrl), 2);
- self::$lang = $lang;
- //prevents default behaviour of redirecting to '/' for '/en/'
- if($this->URLParams['URLSegment'] == "" || $this->URLParams['URLSegment'] == 'home') {
- $urlparams = array('URLSegment' => 'home', 'Action' => ' ');
- if(self::$lang == 'mr'){
- $_POST['this_is_a_hack_to_stop_the_home_redirect'] = true;
- }
- $this->setURLParams($urlparams);
- }
- parent::init();
- }
- static function currentLang() {
- return self::$lang;
- }
- }
- ?>
Add Comment
Please, Sign In to add comment