私のアプリケーションには、app/models/contact.php に Contact モデルがあります。_ コンストラクトを使用して、次のように _ ('some text',true) を使用して値を変換する必要があるリストを配列に追加しました。
class Contact extends AppModel{
var $sex;
function __construct($id = false, $table = null, $ds = null) {
parent::__construct($id, $table, $ds);
$this->sex =array(
'U' => __('Choose Sex', true),
'M' => __('Male', true),
'F' => __('Female', true)
);
}
}
上記の $sex 変数は、次のように HTML select を設定するために使用されます。
// From contacts controller index function
function index(){
$this->set('sex', $this->Contact->sex);
.....
}
// From index view index.ctp
<?php echo $form->input('sex', array('type' => 'select', 'options' => $sex)); ?>
Cake i18n を実行し、Poeditバージョン 1.5.5 を使用して文字列を翻訳し、app/tmp/cache 内のファイルを削除した後、リスト内の文字列が翻訳されていないままになっていることがわかりました。
モデル内の翻訳文字列でこの問題を解決するにはどうすればよいですか?
一般的注意事項:
- CakePHP バージョン 1.2.10
- Windows7 64 ビットの XAMPP AMP パッケージ