0
我正在Cakephp中開發一個用戶庫,用於在我的應用程序中進行翻譯操作。我想在Lib目錄本身中創建.po文件,這就是爲什麼我在Lib目錄內創建Locale文件夾並在各自的語言目錄中創建po文件的原因。但問題是CakePHP默認在默認的Locale位置搜索po文件。現在我的語言環境目錄在Lib文件夾中。如何在cakephp中定義自定義區域路徑?
我該如何讓cakephp在我自己的Locale目錄下的Lib文件夾中搜索po文件?
這裏是我的翻譯類代碼: -
//App::uses($className, $location)
class Translate {
//put your code here
public $defaultLanguage = "";
public function __construct() {
$this->defaultLanguage = Configure::read('Config.language');
}
public function get($key,$language){
Configure::write('Config.language',$language);
return __($key);
}
public function getDefaultLanguage(){
return $this->defaultLanguage;
}
//public function setNewKey()
}
這沒有任何意義。 CakePHP具有內置強大的翻譯系統。 https://book.cakephp.org/3.0/en/core-libraries/internationalization-and-localization.html – burzum
@burzum是的。我正嘗試利用其內置的翻譯系統爲我自己的應用程序創建更簡化和更強大的翻譯庫。 –