继续、驕傲 发表于 2012-9-25 17:17:03

CI框架如何把错误提示改成中文?

CI框架如何把表单验证还有文件上传类的 错误提示改成中文显示呢?求教

Hex 发表于 2012-9-25 18:17:23

下载语言包 http://codeigniter.org.cn/forums/thread-11803-1-1.html

大道达人 发表于 2012-9-25 23:05:02

CI语言包可以加个hook

/**
* 定义 Cier小站针对cier_lang 的 i18n 函数
* @example
* $author = __('ci_author');
* $ci_timestamp = __('ci_timestamp',array(':now' => date(config_item('log_date_format'))));
*/
if ( ! function_exists('__'))
{
    function __($string, array $values = NULL, $lang = NULL)
    {   
      $LANG =& load_class('Lang', 'core');
      $LANG->load('cier');
      $string = $LANG->line($string);

      return empty($values) ? $string : strtr($string, $values);
    }   
}

/* End of file Common.php */
/* Location: ./system/core/Common.php */
//cier_lang.php
$lang['cier_author'] = 'billzhao';
$lang['cier_timestamp'] = '当前时间 :now';

user 发表于 2014-7-10 11:57:54

Hex 发表于 2012-9-25 18:17
下载语言包 http://codeigniter.org.cn/forums/thread-11803-1-1.html

放到哪里?

Hex 发表于 2014-7-10 13:53:55

user 发表于 2014-7-10 11:57
放到哪里?

放到 appliication/lanaguage/chinese 里,chinese 不喜欢可以改成其他目录名,然后在 application/config/config.php 里指定使用 chinese 语言即可,默认是 english。

user 发表于 2014-7-14 08:29:24

已经ok了,谢谢

圆寂大师 发表于 2014-8-6 10:29:38

http://codeigniter.org.cn/forums/forum.php?mod=viewthread&tid=12185&extra=page%3D1

mkdir 发表于 2014-8-27 14:07:42

导入中文错误提示是乱码啊
页: [1]
查看完整版本: CI框架如何把错误提示改成中文?