kohana 語言資源國際化、本地化

語言配置開關:php

root@DESKTOP-I4OIMJC /cygdrive/e/html/tproject/framebota/platform
# grep -n2 'I18n::lang' bootstrap.php
76- * Set the default language
77- */
78:I18n::lang('zh-cn');//en-us
79-
80-if (isset($_SERVER['SERVER_PROTOCOL']))

 

二、語言包html

root@DESKTOP-I4OIMJC /cygdrive/e/html/tproject/combotawork/application/i18n/zh
# pwd
/cygdrive/e/html/tproject/combotawork/application/i18n/zh

root@DESKTOP-I4OIMJC /cygdrive/e/html/tproject/combotawork/application/i18n/zh
# ll
總用量 4.0K
----------+ 1 root ???????? 2.4K 5月  22 11:07 cn.php

root@DESKTOP-I4OIMJC /cygdrive/e/html/tproject/combotawork/application/i18n/zh
# head -n5 cn.php
<?php defined('SYSPATH') or die('No direct script access.');

return array(
    'pageFirst'=>'首頁',
    'pagePrevious'=>'上一頁',

 

三、使用bootstrap

<?php defined('SYSPATH') or die('No direct script access.');

/**
 * 訂單操做
 * @author liuchao
 * @since 20190522
 */
class Controller_Orders_Order extends Controller
{

    /**
     * liuchao 20190522
     * 訂單列表列表控制器
     */
    public function before()
    {
        parent::before();
    }

    /**
     * liuchao 20190522
     * 訂單列表
     */
    public function action_index()
    {
        $v = View::factory();
        $v = View::set('error', I18n::get('cash_error'));
        $this->response->body($v);
    }
}    
相關文章
相關標籤/搜索