Check for more mistakes in translatable strings#64
Conversation
features/makepot.feature
Outdated
| */ | ||
|
|
||
| sprintf( | ||
| _n( '%1$s Comment (%2$s)', '%2$$s Comments (%1$s)', $number, 'foo-plugin' ), |
There was a problem hiding this comment.
double dollar sign here: %2$$s
src/MakePotCommand.php
Outdated
| $plural_placeholders = $plural_placeholders[0]; | ||
|
|
||
| // see https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/#plurals | ||
| if ( count( $single_placeholders ) < \count( $plural_placeholders ) ) { |
There was a problem hiding this comment.
Two different forms of count() used, one relative and one absolute.
| $location | ||
| ) ); | ||
| } else { | ||
| sort( $single_placeholders ); |
There was a problem hiding this comment.
I'm probably missing something here, but I think it warrants a comment. The goal here is to verify the ordering of the placeholders. However, before comparing them, you sort them here. Would that put them into the same order no matter what?
There was a problem hiding this comment.
I don't know what I was thinking here. I copied this from WPCS, but somehow messed it up. The order should be irrelevant, but different placeholders are usually not ok.
|
I think this one is good to go (pending passing tests and final review). Nice side effect when this is in master: I can use #69 to create a WordPress Trac ticket to improve all the strings in WordPress core that get flagged by this command. |
Check for more mistakes in translatable strings
See #61.