Skip to content

Commit 780e31f

Browse files
committed
增加项目公共语言包支持
1 parent 568e13f commit 780e31f

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

Extend/Behavior/CheckLangBehavior.class.php

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,23 @@ private function checkLanguage() {
6565
define('LANG_SET',strtolower($langSet));
6666

6767
$group = '';
68-
$lang_path = (defined('GROUP_NAME') && C('APP_GROUP_MODE')==1) ? BASE_LIB_PATH.'Lang/'.LANG_SET.'/' : LANG_PATH.LANG_SET.'/';
69-
// 读取项目或者独立分组公共语言包
70-
if (is_file($lang_path.'common.php'))
71-
L(include $lang_path.'common.php');
72-
// 普通分组公共语言包
73-
if (defined('GROUP_NAME') && C('APP_GROUP_MODE')==0){
74-
if (is_file($lang_path.GROUP_NAME.'.php'))
75-
L(include $lang_path.GROUP_NAME.'.php');
76-
$group = GROUP_NAME.C('TMPL_FILE_DEPR');
68+
$path = (defined('GROUP_NAME') && C('APP_GROUP_MODE')==1) ? BASE_LIB_PATH.'Lang/'.LANG_SET.'/' : LANG_PATH.LANG_SET.'/';
69+
// 读取项目公共语言包
70+
if(is_file(LANG_PATH.LANG_SET.'/common.php'))
71+
L(include LANG_PATH.LANG_SET.'/common.php');
72+
// 读取分组公共语言包
73+
if(defined('GROUP_NAME')){
74+
if(C('APP_GROUP_MODE')==1){ // 独立分组
75+
$file = $path.'common.php';
76+
}else{ // 普通分组
77+
$file = $path.GROUP_NAME.'.php';
78+
$group = GROUP_NAME.C('TMPL_FILE_DEPR');
79+
}
80+
if(is_file($file))
81+
L(include $file);
7782
}
7883
// 读取当前模块语言包
79-
if (is_file($lang_path.$group.strtolower(MODULE_NAME).'.php'))
80-
L(include $lang_path.$group.strtolower(MODULE_NAME).'.php');
84+
if (is_file($path.$group.strtolower(MODULE_NAME).'.php'))
85+
L(include $path.$group.strtolower(MODULE_NAME).'.php');
8186
}
8287
}

0 commit comments

Comments
 (0)