Yes we're getting issues. Specially when we use __ and sprintf
combined, as in
<?= sprintf( __( "Username: %s"), $username ) ?>
In cake1.2 it renders:
"djogo Username:%s"
Speaking of that, I would like to post a (perl) script I used to
change _(..) to __(..). It would be improved, adding (or removing) a
",true)" to the end of the call.
----
#!/usr/bin/perl
open H, $ARGV[0] or die "cant open $ARGV[0]\n";
open I, ">$ARGV[0].mod";
while(<H>)
{
s/^_\s*\(/__\(/g;
s/([^_])_\s*\(/\1__\(/g;
print I;
}
close I;
close H;
rename( $ARGV[0], "$ARGV[0].bak" );
rename( "$ARGV[0].mod", "$ARGV[0]" );
On Dec 18, 2:04 pm, euromark <[email protected]> wrote:
> the switching process will be causing quite a few new bugs i
> imagine :)
> at least without really good regexp substitutions
>
> On 18 Dez., 16:43, djogo <[email protected]> wrote:
>
> > That's good news indeed.
>
> > In which version this feature is planned to be in?
>
> > I guess I'll just use a patched version of cake 1.2.5 until this
> > version comes out.
>
> > On Dec 17, 10:45 pm, euromark <[email protected]> wrote:
>
> > > nice to hear that
> > > especially as it is used in controllers, components etc too
> > > and there the echo default is not that much used :)
>
> > > On 17 Dez., 19:47, "Larry E. Masters aka PhpNut" <[email protected]>
> > > wrote:
>
> > > > I have plans to change the __*() functions to return by default it has
> > > > not
> > > > been implemented yet
>
> > > > --
> > > > /**
> > > > * @author Larry E. Masters
> > > > * @var string $userName
> > > > * @param string $realName
> > > > * @returns string aka PhpNut
> > > > * @access public
> > > > */
>
> > > > On Thu, Dec 17, 2009 at 12:31 PM, euromark
> > > > <[email protected]>wrote:
>
> > > > > 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 <[email protected]> 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 sitehttp://cakeqs.organdhelpothers
> > > > > 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 [email protected]
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected]<cake-php%[email protected]>For
> > > > > more options, visit this group at
> > > > >http://groups.google.com/group/cake-php?hl=en
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 [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en