Translate string within array with __ in CakePHP -


i have array of different priorities in controller:
var $priorities = array(3 => 'low', 2 => 'medium', 1 => 'high');

how manage translate these values __-function? array php expects closing ')' bracket. code tried use:
var $priorities = array(3 => __('low'), 2 => __('medium'), 1 => __('high'));

i use variable set in add , edit-action. these options in select-input , if theres change, don't want fiddle around in views.

judging var keyword suspect you're trying declare class property here. doesn't work, can declare properties using static values, i.e. can't call functions @ point or operations.

you'll need translate values @ later point, or assign them $this->priorities later on. __construct method place, if it's controller beforefilter too.

you'll need call __ function true second parameter:

$this->priorities = array(3 => __('low', true), 2 => __('medium', true), 1 => __('high', true)); 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -