Currently i have a language loaded inside MY_Controller which extends CI_Controller. But inside a special page which controller (let's call it ABC controller) extends MY_Controller, I need to override the loaded language with another language. I tried loading another language inside this ABC controller, but unsuccessful. Is there a way to unload the loaded language and load another language?
5条回答 默认 最新
- dongmi8980 2011-09-27 01:59关注
Have you tried just loading the language file you need?$this->lang->load('filename', 'language');
It should be then accessible just like your default language. I haven't tested this tho, but from my understanding this should be the way to go about it.Reference: http://codeigniter.com/user_guide/libraries/language.html
REVISED
I ended up digging a bit more for you, and found that you CANNOT load a default language (define it as default in your controller) and then later try to change it to something else.
Follow these steps:
- If you need a language OTHER than english (default), set that in your config.
- If you want to load ANOTHER language on a controller basis, you need to define that (most commonly in your
constructor
using something like session array / user selection. - You cannot load 2 languages (1 in the constructor, then another in a different class.. won't work!)
Reference here per forum posts: http://codeigniter.com/forums/viewthread/176223/
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 救!ENVI5.6深度学习初始化模型报错怎么办?
- ¥30 eclipse开启服务后,网页无法打开
- ¥30 雷达辐射源信号参考模型
- ¥15 html+css+js如何实现这样子的效果?
- ¥15 STM32单片机自主设计
- ¥15 如何在node.js中或者java中给wav格式的音频编码成sil格式呢
- ¥15 不小心不正规的开发公司导致不给我们y码,
- ¥15 我的代码无法在vc++中运行呀,错误很多
- ¥50 求一个win系统下运行的可自动抓取arm64架构deb安装包和其依赖包的软件。
- ¥60 fail to initialize keyboard hotkeys through kernel.0000000000