-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
\Magento\Framework\Phrase\Renderer\Placeholder::render() can't handle more than 9 placeholders #1374
Comments
We can fix this easily by reversing the ordering of the items in the |
@joshdifabio yeah but that just "covers" the problem that str_replace might not be the right piece of PHP for that task? What happened to sprintf here? |
Well, I'm not part of Magento but I'll try to guess the reasons. The interface of this method is quite different to that of With Magento's current approach: __('An %foo can look like %bar', ['foo' => 'input', 'bar' => 'this'])
__('An %s can look like %s', ['input', 'this']) With Magento's current approach: __('This %1 contains %2 of %3 so %4 numbered %5 is %6', ['sentence', 'lots', 'words', 'a', 'approach', 'helpful'])
__('This %1$s contains %2$s of %3$s so %4$s numbered %5$s is %6$s', ['sentence', 'lots', 'words', 'a', 'approach', 'helpful']) I suppose Magento only wish to support simple string replacements and therefore they opted for a smaller and more focused interface than what |
Thanks for taking the time to think about that @joshdifabio :-) 👍 |
MAGETWO-70683 New registered customer not showed in admin customer grid MAGETWO-70869 Console errors after turning on CSS merging/minification
Using the code fragment
in a phtml file will result in the following wrong output:
because Placeholder Renderer uses str_replace which replaces %10 in the first place.
Question: What exactly was wrong with the old sprintf rendering?!
The text was updated successfully, but these errors were encountered: