2014-07-16 140 views
1

我有一個名爲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']; 
} 

允許用戶在特定文章中進行投票。

問題是,當您點擊投票按鈕時,文本「有一個帳戶?」不會出現!

爲什麼會發生這種情況?哪裏有問題?

+0

語言文件必須被命名爲更多信息_lang.php檢查此http: //ellislab.com/codeigniter/user-guide/libraries/language.html – AVM

+0

@AVM我試圖將文件重命名爲en_theme.php,但我得到了相同的結果:(沒有文字顯示! – traveler

+0

使用$ this-> lang-> line('sources_HAVE_AN_ACCOUNT');而不是$ LANG ['sources_HAVE_AN_ACCOUNT']並檢查 – AVM

回答

0

幾件事情要檢查:

  • theme_lang.php文件必須位於成application/language/english/
  • 添加theme到位於application/config/autoload.php
  • 入住的application/config/config.php文件中的$autoload['langage']陣列,你$config['language']設置爲english

然後,用翻譯在votes.php控制器,使用此:

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

您可以在笨的Language Class documentation