Thursday, December 17, 2009

Default __() parameters causes problems

Our previous, cake1.1, code was internationalized using php's gettext
library and the function _().

Cake1.2 now uses __(), which is great, because doesn't require us to
"compile" .po files anymore.

However, the default behaviour of __() is to echo the translated
string, instead of returning it, therefore I'm having a lot of heavy
work going from _( $a ) to __( $a, true ). I have a regexp for
translating _() to __(), but I couldn't figure out how to insert the
",end" parameter in the end of the call.

I though to create a patch in the __() function to change the default
value, but I don't want to have my own "version" of cakephp.

Or, I may create

function ___($a) { return __($a,true); }


I _really_ think cakephp designers should make the second parameters
true by default, to turn the transition easy. However, I need my code
functioning in CAKE 1.2. Do anybody have some tip?

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate