Thursday, March 31, 2011

gettext in controller

Why trying to use gettext in the controller is not working?
function __translate($data){
foreach ($data as $key => $value) {
$data[$key] = __($value,true);
#$data[$key] = $value.'123'; This will work
}
return $data
}

The same code as a view helper is working fine

class TranslationHelper extends Helper {
function translate($data) {
foreach ($data as $key => $value) {
$data[$key] = __($value,true);
}
return $data;
}
}

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: