Codeigniter框架中的语言问题

时间:2014-07-16 11:48:53

标签: php mysql codeigniter

我有一个名为theme.php的语言文件,在这个文件中有一行

$LANG['sources_HAVE_AN_ACCOUNT'] = "Have an account?";  

现在在名为votes.php的文件中,我正在使用代码:

 if($r) //voting done
 {
 echo "". $LANG['sources_HAVE_AN_ACCOUNT']." <a href='../login' target='_blank'  #0087F7; text-decoration: none; font-weight: bold;'>".$LANG['header_LOGIN_title']."</a>";
 }
 elseif(!$r) //voting failed
 {
 $effectiveVote = getEffectiveVotes($id);
 echo $effectiveVote." ".$LANG['sources_POINTS_title'];
 }  

允许用户在特定文章中进行投票。

问题是,当您点击投票按钮时,文本“有帐户?”不会出现!!

为什么会这样?问题在哪里?

1 个答案:

答案 0 :(得分:0)

要检查的几件事情:

  • 您的theme_lang.php文件必须位于application/language/english/
  • theme添加到位于$autoload['langage']
  • application/config/autoload.php数组中
  • 检入application / config / config.php,将$config['language']设置为english

然后,要使用votes.php控制器中的翻译,请使用:

$this->lang->line('sources_HAVE_AN_ACCOUNT');

您可以在Codeigniter的Language Class documentation

中找到更多信息