Created
April 13, 2012 14:38
-
-
Save mpmont/2377323 to your computer and use it in GitHub Desktop.
Linguagem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
class MY_Config extends CI_Config { | |
function site_url($uri = '') | |
{ | |
if (is_array($uri)) | |
{ | |
$uri = implode('/', $uri); | |
} | |
if (function_exists('get_instance')) | |
{ | |
$CI =& get_instance(); | |
//$uri = $CI->lang->localized($uri); | |
} | |
return parent::site_url($uri); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//No construtor do my controller | |
public function __construct() | |
{ | |
parent::__construct(); | |
$this->data['language'] = $this->uri->segment(1); | |
//If not defined redirect | |
if(empty($this->data['language'])) | |
redirect('pt/home'); | |
//else get the correct lang pack | |
switch ($this->data['language']) { | |
case 'pt': | |
$this->lang->load('front-end', 'portuguese'); | |
break; | |
case 'en': | |
$this->lang->load('front-end', 'english'); | |
break; | |
default: | |
$this->lang->load('front-end', 'english'); | |
break; | |
} | |
//Load Dependencies | |
$this->load->model('article_model', 'article'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$route['^pt/(.+)$'] = "$1"; | |
$route['^en/(.+)$'] = "$1"; | |
$route['default_controller'] = "home"; | |
$route['^pt$'] = $route['default_controller']; | |
$route['^en$'] = $route['default_controller']; | |
$route['404_override'] = ''; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment