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
Print some more helpful debug messages #56
Conversation
src/MakePotCommand.php
Outdated
@@ -300,6 +319,8 @@ protected function makepot() { | |||
|
|||
// Add existing strings first but don't keep headers. | |||
if ( $this->merge ) { | |||
WP_CLI::debug( sprintf( 'Mergining with existing POT file: %s', $this->merge ), 'make-pot' ); |
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.
There's a typo here: Mergining
=> Merging
src/MakePotCommand.php
Outdated
|
||
WP_CLI::debug( sprintf( 'Destination: %s', $this->destination ), 'make-pot' ); | ||
if ( isset( $this->merge ) && ! file_exists( $this->merge ) ) { | ||
WP_CLI::warning( sprintf( 'POT file to merge with does not exist: %s', $this->merge ) ); |
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.
Typo: with
=> which
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.
Seems correct to me: "The POT file you want to merge the new translations with(,) does not exist".
Perhaps there's a less ambiguous sentence though.
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.
Ah, I read it in a different way: "Here is a reference to the POT file we wanted to merge but which does not exist: ...".
Some random ideas for an alternative...
- "Merge target does not exist: ..."
- "POT file to be merged does not exist: ..."
- "Invalid POT file set as merge target: ..."
- "File to merge is not valid: ..."
- "Invalid file provided to --merge: ..."
src/MakePotCommand.php
Outdated
$translations_count = count( $this->translations ); | ||
|
||
if ( 1 === $translations_count ) { | ||
WP_CLI::debug( sprintf( 'Extracted %d string', count( $this->translations ) ), 'make-pot' ); |
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.
Reuse $translations_count
here
src/MakePotCommand.php
Outdated
if ( 1 === $translations_count ) { | ||
WP_CLI::debug( sprintf( 'Extracted %d string', count( $this->translations ) ), 'make-pot' ); | ||
} else { | ||
WP_CLI::debug( sprintf( 'Extracted %d strings', count( $this->translations ) ), 'make-pot' ); |
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.
Reuse $translations_count
here
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.
Maybe we should move over the Inflector
class from wp-cli/scaffold-package
for strings like this.
You could then do something along these lines:
WP_CLI::debug( sprintf(
'Extracted %d %s',
$translations_count,
Utils\maybe_pluralize( 'string', $translations_count )
), 'make-pot' );
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.
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.
Only now saw this. The same applies to the language command as well, so 👍
Print some more helpful debug messages
See #46.