-
Notifications
You must be signed in to change notification settings - Fork 52
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two different forms of count()
used, one relative and one absolute.
src/MakePotCommand.php
Outdated
$location | ||
) ); | ||
} else { | ||
sort( $single_placeholders ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.