cakePHP国际化和本地化

使用的是一种叫做 

// App Controller Code.
public function beforeFilter() {
    $locale = Configure::read('Config.language');
    if ($locale && file_exists(VIEWS . $locale . DS . $this->viewPath)) {
        // e.g. use /app/View/fre/Pages/tos.ctp instead of /app/View/Pages/tos.ctp
        $this->viewPath = $locale . DS . $this->viewPath;
    }
}

先看一个小例子,很多东西都明白了,使用这个系统后,每个语言写一个语言包然后设置相关翻译的方法即可

使用__()方法进行翻译

需要几个条件

1、设置本地语言配置

2、配置default.po文件

即可

原文地址:https://www.cnblogs.com/linksgo2011/p/2937076.html