If you have a configurable list in table(t_credit_types) like:
1->Gold
2->Silver
3->Bronze
and you have get all data from that table by a find.
Now instead of using the english string in a selection box, you are required to display localized strings.
There are two ways of localizing the selection box in cakephp.
Solution 1. provide localized strings in db table
t_credits_types_lang
(credit_type_id+lang+description)
1->zh_CN->黄金
2->zh_CN->白银
3->zh_CN->黄铜
now you can find all localized strings from this additional table by certain language code.
$types = $this->CreditType->find('list', array('conditions' => array('lang'=>'zh_CN'),
'fields' => array('type','description'),
));
echo $form->input('type', array('type' => 'select', 'options' => $types));
Solution 2. localize these strings in view template
say, if you retreived all types by below sql:
$types = $this->CreditType->find('list', array(
'fields' => array('type','description'),
));
in view template, what we need to do is simply as:
$lc_types = array();
foreach($types as $key=>$value) {
$lc_types[$key] = __($value, true);
}
echo $form->input('type', array('type' => 'select', 'options' => $lc_types));