自动加载语言代码点火器
使用 codeginiter 制作多语言网站。我创建了两个文件夹。一份用于法语文件,一份用于英语。当我自动加载语言(英语和法语)时,
($autoload['language'] = array('en', 'fr');)
出现错误“无法加载请求的语言文件:语言/english/fr_lang.php”,
如何让它在正确的文件夹中查找?
谢谢
making a multi-language site with codeginiter. I have created two folders. One for french language files and one for english. When I go to autoload the languages (English and French) as such
($autoload['language'] = array('en', 'fr');)
I get an error "Unable to load the requested language file: language/english/fr_lang.php"
How can I get it to look in the proper folder?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是用于加载语言文件的默认文件夹,这就是
从那里加载您的语言文件的原因。
可以更改:的值
需要时
,例如:(请记住,这必须在语言加载之前完成,因此您可以使用钩子http://codeigniter.com/user_guide/general/hooks.html。)
或者,动态加载您的语言文件:
您绝对应该检查核心类以获取更好地理解事物是如何运作的。您可以在这里轻松浏览代码:https://github.com/EllisLab/CodeIgniter
例如,语言加载了此类: https:// github.com/EllisLab/CodeIgniter/blob/develop/system/core/Lang.php
如果您需要任何更多帮助,请告诉我。
is the default folder used for loading language files, which is why your
is loaded from there.
Either change the value of:
when needed, like:
(Remember this has to be done before the languages load, so you would use a hook for that http://codeigniter.com/user_guide/general/hooks.html.)
Or else, load your language files on the fly:
You should definitely check out the core classes to get a better understanding of how things work. You can browse the code easily here: https://github.com/EllisLab/CodeIgniter
For instance, the languages are loaded with this class: https://github.com/EllisLab/CodeIgniter/blob/develop/system/core/Lang.php
If you need any more help, let me know.