Skip to content

Commit

Permalink
add example for show auto load language and manual language
Browse files Browse the repository at this point in the history
  • Loading branch information
LCTL committed Dec 18, 2011
1 parent fa6d552 commit a5f8389
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
18 changes: 18 additions & 0 deletions application/controllers/i18nauto.php
@@ -0,0 +1,18 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class I18nauto extends CI_Controller{

public function __construct()
{
parent::__construct();
$this -> load -> library('i18n');
}

public function index(){
$this -> load -> view('i18ntest');
}

}

/* End of file i18nauto.php */
/* Location: ./application/controller/i18nauto.php */
21 changes: 21 additions & 0 deletions application/controllers/i18nmanual.php
@@ -0,0 +1,21 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class I18nmanual extends CI_Controller{

public function __construct()
{
parent::__construct();
$this -> load -> library('i18n');
$this -> i18n -> prevent_auto();
}

public function index(){
$this -> i18n -> set_current_locale('zh-TW');
$this -> i18n -> load_language();
$this -> load -> view('i18ntest');
}

}

/* End of file i18nmanual.php */
/* Location: ./application/controller/i18nmanual.php */
8 changes: 8 additions & 0 deletions application/views/i18ntest.php
@@ -0,0 +1,8 @@
<html>
<head>
<title><?php echo $this->lang->line('site_name'); ?></title>
</head>
<body>
<?php echo $this->lang->line('message'); ?>
</body>
</html>

0 comments on commit a5f8389

Please sign in to comment.