如何为真正的多语言网站设置 CodeIgniter? [英] How to setup CodeIgniter for a truly multi language website?

查看:34
本文介绍了如何为真正的多语言网站设置 CodeIgniter?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将 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();

此处解释了加载语言文件并处理它们:https://www.codeigniter.com/user_guide/libraries/language.html

Loading language files and handling them is explained here: https://www.codeigniter.com/user_guide/libraries/language.html

帮手:https://www.codeigniter.com/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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆