You are correct in bake this would be needed, I should have opened the code and looked where it was.
Stay this diligent when we release 2.0 and help improve it. -- Larry E. Masters On Wed, Dec 22, 2010 at 3:33 PM, Ryan Schmidt <[email protected]>wrote: > > On Dec 22, 2010, at 15:07, Larry E. Masters wrote: > > > The code you showed is not correct in 2.0, but your suggestion is not > correct either. I am just trying to point out 2.0 is not release or ready to > start using and reporting "bugs" on unreleased code is useless. > > > > The correct code is more like this without the printf() > > > > <legend><?php echo __('%s %s', Inflector::humanize($action), > $singularHumanName);?></legend> > > > > The second param in the function accepts a list of coma separated strings > or an array and vsprintf() is used to return the value of the translated > string. > > > > Before we release these issues will be corrected. Besides writing great > code, testing is one of our teams finer points. > > Mm, I believe there's much I can learn from the CakePHP codebase with > regard to testing. I look forward to diving into that a little later. I'm > sure testing will help you find and resolve problems later, but I'm sure you > agree finding bugs sooner rather than later is a good thing. So I hope I'm > not imposing by pursuing this matter. > > I do understand that __() now supports printf functionality; this pleases > me as it should help streamline the code. But in this line, the printf() is > being processed by bake, while the __() is ultimately being processed by the > view when it's running within the application. > > > Take the code from CakePHP 1.3.6: > > <legend><?php printf("<?php __('%s %s'); ?>", > Inflector::humanize($action), $singularHumanName); ?></legend> > > If for example we're baking a view for the edit action of the users model, > then after baking, the line in the view will look like this: > > <legend><?php __('Edit User'); ?></legend> > > And this of course works because __() echoes by default. > > > With the current 2.0 branch's code... > > <legend><?php printf("<?php __('%s %s', true); ?>", > Inflector::humanize($action), $singularHumanName); ?></legend> > > ...the baked view would look like this... > > <legend><?php __('Edit User', true); ?></legend> > > ...which is not correct because __() does not echo on its own, and no > longer accepts a Boolean as the second parameter. > > > With your proposed change... > > <legend><?php echo __('%s %s', Inflector::humanize($action), > $singularHumanName);?></legend> > > ...the baked view would say... > > <legend>Edit User</legend> > > ...(the __() would be processed by bake) and thus the string would no > longer be localizable in the view. > > > Using my suggested change to the line... > > <legend><?php printf("<?php echo __('%s %s'); ?>", > Inflector::humanize($action), $singularHumanName); ?></legend> > > ...the result in the view is... > > <legend><?php echo __('Edit User'); ?></legend> > > ...which seems to be the correct thing. > > > > > 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]<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
