Skip to content

Commit

Permalink
1855
Browse files Browse the repository at this point in the history
  • Loading branch information
easychen committed Mar 6, 2013
1 parent 34b0907 commit 552c4b6
Show file tree
Hide file tree
Showing 23 changed files with 330 additions and 163 deletions.
18 changes: 10 additions & 8 deletions _lp/core/lib/core.function.php
Expand Up @@ -237,28 +237,30 @@ function load( $file_path )
// use master db on sae to void sync problem
include_once( CROOT . 'lib/db.function.php' );

if (!function_exists('_'))
if (!function_exists('__'))
{
function _( $string , $data = null )
function __( $string , $data = null )
{
if( !isset($GLOBALS['i18n']) )
{
$c = c('default_language');
if( strlen($c) < 1 ) $c = 'zh_cn';

if( strlen($c) < 1 ) $c = 'zh_cn';
}
else
$c = z(t($GLOBALS['i18n']));

if( !isset( $GLOBALS['language'][$c] ) )
{
$lang_file = AROOT . 'local' . DS . basename($c) . '.lang.php';
if( file_exists( $lang_file ) )
{
include_once( $lang_file );
$GLOBALS['i18n'] = $c;
}
else
$GLOBALS['i18n'] = 'zh_cn';


$GLOBALS['i18n'] = 'zh_cn';
}

//print_r( $GLOBALS['language'][$GLOBALS['i18n']] );



Expand Down
1 change: 1 addition & 0 deletions config/app.config.sample.php
Expand Up @@ -14,6 +14,7 @@
$GLOBALS['config']['can_modify_password'] = true ;
$GLOBALS['config']['timezone'] = 'Asia/Chongqing' ;
$GLOBALS['config']['dev_version'] = false ;
$GLOBALS['config']['default_language'] = 'zh_cn' ;

// session time
// you need change session lifetime in php.ini to0
Expand Down
5 changes: 5 additions & 0 deletions controller/app.class.php
Expand Up @@ -9,6 +9,11 @@ class appController extends coreController
{
function __construct()
{
// 检测语言
if( isset($_COOKIE['tt2_lang']) ) $GLOBALS['i18n'] = z(t(basename($_COOKIE['tt2_lang'])));
else $GLOBALS['i18n'] = c('default_language');


// 安装时不启用插件
if(g('c')!= 'install')
{
Expand Down

0 comments on commit 552c4b6

Please sign in to comment.