dtch60248 2014-07-16 11:48
浏览 27
已采纳

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?

  • 写回答

1条回答 默认 最新

  • douxin1884 2014-07-16 12:44
    关注

    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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 ROS Turtlebot3 多机协同自主探索环境时遇到的多机任务分配问题,explore节点
  • ¥15 Matlab怎么求解含参的二重积分?
  • ¥15 苹果手机突然连不上wifi了?
  • ¥15 cgictest.cgi文件无法访问
  • ¥20 删除和修改功能无法调用
  • ¥15 kafka topic 所有分副本数修改
  • ¥15 小程序中fit格式等运动数据文件怎样实现可视化?(包含心率信息))
  • ¥15 如何利用mmdetection3d中的get_flops.py文件计算fcos3d方法的flops?
  • ¥40 串口调试助手打开串口后,keil5的代码就停止了
  • ¥15 电脑最近经常蓝屏,求大家看看哪的问题