最好的办法,使codeigniter网站多国语言。从郎阵列呼吁取决于郎会话吗? [英] the best way to make codeigniter website multi-language. calling from lang arrays depends on lang session?

查看:90
本文介绍了最好的办法,使codeigniter网站多国语言。从郎阵列呼吁取决于郎会话吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我研究几个小时,但我找不到任何明确的,有效的方式,使其:/

I'm researching hours and hours, but I could not find any clear, efficient way to make it :/

我在英语codeigniter基地的网站,我现在已经添加波兰语。是什么使我的网站在2语言取决于游客选择的最佳方式?

I have a codeigniter base website in English and I have to add a Polish language now. What is the best way to make my site in 2 language depending visitor selection?

有没有办法来为每种语言创建阵列的文件,并致电他们在查看文件取决于会话从郎选择?我不想使用的数据库。

is there any way to create array files for each language and call them in view files depends on Session from lang selection? I don't wanna use database.

鸭preciate帮助!我跑出来的最后期限:/感谢!!

Appreciate helps! I'm running out of deadline :/ thanks!!

推荐答案

你见过 codeIgniter的语言库

语文课上提供的功能
  检索语言文件和行
  文本对国际化的目的。

The Language Class provides functions to retrieve language files and lines of text for purposes of internationalization.

在您的codeIgniter系统,你会文件夹
  找到一个名为包含语言集
  的语言文件。您可以创建
  自己的语言文件,根据需要,为了
  显示错误和其他消息的
  其它语言。

In your CodeIgniter system folder you'll find one called language containing sets of language files. You can create your own language files as needed in order to display error and other messages in other languages.

身处文件通常存储在
  您的系统/语言目录。交替
  你可以创建一个文件夹,名为语言
  您的应用程序文件夹,里面存放
  他们那里。 codeIgniter先来看看
  在应用程序/语言目录。
  如果目录不存在或
  指定的语言是不是设在那里
  CI反而会看在你的全局
  系统/语言文件夹。

Language files are typically stored in your system/language directory. Alternately you can create a folder called language inside your application folder and store them there. CodeIgniter will look first in your application/language directory. If the directory does not exist or the specified language is not located there CI will instead look in your global system/language folder.

在你的情况...


  • 您需要创建一个 polish_lang.php english_lang.php 应用程序/语言/抛光

  • 然后创建一个文件中的键(例如 $ LANG ['你好'] =Witaj;

  • 然后加载它在你的控制器如 $这个 - >朗GT&;负载('polish_lang','抛光');

  • 然后取像 $这个 - &GT行;朗>行('你好'); 就在这个函数的返回值存储在一个变量,所以你可以在视图中使用它。

  • you need to create a polish_lang.php and english_lang.php inside application/language/polish
  • then create your keys inside that file (e.g. $lang['hello'] = "Witaj";
  • then load it in your controller like $this->lang->load('polish_lang', 'polish');
  • then fetch the line like $this->lang->line('hello'); Just store the return value of this function in a variable so you can use it in your view.

重复上述步骤为英语和其他语言的需要。

Repeat the steps for the english language and all other languages you need.

这篇关于最好的办法,使codeigniter网站多国语言。从郎阵列呼吁取决于郎会话吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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