Codeigniter框架中的语言问题

I have a language file called theme.php and in this file there is the line

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

Now in the file called votes.php i am using the code:

 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'];
 }  

to allow users to perform a vote in a specific article.

The problem is that when you click on the vote button the text “Have an account?” doesn’t appears!!

Why is this happens? Where is the problem?

Several things to check :

  • Your theme_lang.php file must be located into application/language/english/
  • Add theme to the $autoload['langage'] array located in application/config/autoload.php
  • Check in application/config/config.php that your $config['language'] is set to english

Then, to use the translations in your votes.php controller, use this :

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

You can find more info in the Language Class documentation of Codeigniter