怎么实现ecshop多语言切换
1个回答
2016-11-12
展开全部
打开includds/init.php
粘贴以下代码到200行左右if (!defined('INIT_NO_USERS')) 上面
if(!empty($_REQUEST['lang'])){
$_SESSION['lang']=$_REQUEST['lang'];
}
if (!empty($_SESSION['lang']))
{
switch($_SESSION['lang']){
case 'zh_cn':
$_CFG['lang']="zh_cn";
break;
case 'zh_tw':
$_CFG['lang']="zh_tw";
break;
case 'en_us':
$_CFG['lang']="en_us";
break;
}
}
require(ROOT_PATH . 'languages/' . $_CFG['lang'] . '/common.php');
$smarty->assign('lang', $_LANG);
删除原来的:
require(ROOT_PATH . 'languages/' . $_CFG['lang'] . '/common.php');
$smarty->assign('lang', $_LANG);
然后页面再调用:
<a href="?lang=zh_cn">简体</a>
<a href="?lang=zh_tw">繁体</a>
<a href="?lang=en_us">英文</a>
粘贴以下代码到200行左右if (!defined('INIT_NO_USERS')) 上面
if(!empty($_REQUEST['lang'])){
$_SESSION['lang']=$_REQUEST['lang'];
}
if (!empty($_SESSION['lang']))
{
switch($_SESSION['lang']){
case 'zh_cn':
$_CFG['lang']="zh_cn";
break;
case 'zh_tw':
$_CFG['lang']="zh_tw";
break;
case 'en_us':
$_CFG['lang']="en_us";
break;
}
}
require(ROOT_PATH . 'languages/' . $_CFG['lang'] . '/common.php');
$smarty->assign('lang', $_LANG);
删除原来的:
require(ROOT_PATH . 'languages/' . $_CFG['lang'] . '/common.php');
$smarty->assign('lang', $_LANG);
然后页面再调用:
<a href="?lang=zh_cn">简体</a>
<a href="?lang=zh_tw">繁体</a>
<a href="?lang=en_us">英文</a>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询