Re: Default __() parameters causes problems
i do agree that this is one of the few remaining inconsistencies
remaining in cake1.2/1.3
all other functions return by default
e.g. in 1.3 the flash() messages now are returned by default, although
scripts/css are inline by default (and therefore echod too).
returning should be the default value in most cases
but i dont think in the __() case this is going to happen :)
at least it doesnt look like it
using the ___() function might be a very neat way of fixing it for
you, though
the overhead is minimal
you should then use the second param though!
function ___($a, $return = true) { return __($a, $return); }
to be more flexible
On 17 Dez., 18:39, djogo <djogopat...@gmail.com> wrote:
> 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