如何设置CodeIgniter真正的多语言网站? [英] How to setup CodeIgniter for a truly multi language website?
问题描述
我需要将CodeIgniter设置为一个真正的多语言网站。我已搜索,但我找不到解决方案。
I need to setup CodeIgniter to be a truly multi language website. I've searched but I can't find a solution.
我已经测试了这种方法,但它不工作。 ( http://codeigniter.com/wiki/Category%3AInternationalization%3A%3AInternationalization_Views_i18n /)
I've tested this approach but it is not working. (http://codeigniter.com/wiki/Category%3AInternationalization%3A%3AInternationalization_Views_i18n/)
有人可以告诉我在CodeIgniter中使用什么设置来获得真正的多语言环境?
Can someone give me a clue about what setup to use to get a truly multi language environment in CodeIgniter?
注意,
推荐答案
https://github.com/EllisLab/CodeIgniter/wiki/CodeIgniter-2.1-internationalization-i18n
如果实现此操作,您的网址将包含语言代码。您可以在语言目录中保存语言部分。使用函数lang();
If you implement this, you URLs will contain the language code. You can save your language parts in the language directory. With the function lang();
加载语言文件并处理它们:
http://ellislab.com/codeigniter/user-guide/libraries/language.html
Loading language files and handling them is explained here: http://ellislab.com/codeigniter/user-guide/libraries/language.html
助手:
http://ellislab.com /codeigniter/user-guide/helpers/language_helper.html
最简单的方法是自动加载一些全局语言文件。我建议为每个控制器创建一个语言文件。因此,您只需加载所需的零件,而不是加载所有语言文件。
Easiest way is have to some global language files which you auto load. I suggest creating a language file for every controller. So you only load the part you need instead of loading all language files.
这篇关于如何设置CodeIgniter真正的多语言网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!