Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions class-tgm-plugin-activation.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public function init() {
'tgmpa'
),
'return' => __( 'Return to Required Plugins Installer', 'tgmpa' ),
'dashboard' => __( 'Return to the dashboard', 'tgmpa' ),
'dashboard' => __( 'Return to the Dashboard', 'tgmpa' ),
'plugin_activated' => __( 'Plugin activated successfully.', 'tgmpa' ),
'activated_successfully' => __( 'The following plugin was activated successfully:', 'tgmpa' ),
'plugin_already_active' => __( 'No action taken. Plugin %1$s was already active.', 'tgmpa' ),
Expand Down Expand Up @@ -1918,7 +1918,13 @@ public function force_deactivation() {
*/
public function show_tgmpa_version() {
echo '<p style="float: right; padding: 0em 1.5em 0.5em 0;"><strong><small>',
esc_html( sprintf( _x( 'TGMPA v%s', '%s = version number', 'tgmpa' ), self::TGMPA_VERSION ) ),
esc_html(
sprintf(
/* translators: %s: version number */
__( 'TGMPA v%s', 'tgmpa' ),
self::TGMPA_VERSION
)
),
'</small></strong></p>';
}

Expand Down Expand Up @@ -2272,7 +2278,8 @@ protected function get_plugin_status_text( $slug ) {
}

return sprintf(
_x( '%1$s, %2$s', '%1$s = install status, %2$s = update status', 'tgmpa' ),
/* translators: %1$s: install status, %2$s: update status */
_x( '%1$s, %2$s', 'Install/Update Status', 'tgmpa' ),
$install_status,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this 'string' is so generic, should it not have a translators comment and a context through _x ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jrfnl,

The context is used to describe the entire string, translators comment are used to describe specific placeholders like %s, %1$s, %2$s and others.

Translators comment location

In this case, translators comment are needed because we have two placeholders in this string.

As for the context, I'm not sure. We can set "Install/Update Status" as a context, but It's not providing more information than the translator comment.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, I'd prefer to have both the translators comment and the context. The TGMPA library is included in themes as well as plugins and in the case of wp.org hosted themes, the text-domain is replaced by the theme text-domain.
If, for whatever reason, the theme would have the same generic string in use, things could become very confusing for translators.
For the other strings, I'd think that to be far less likely.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a very good point. I agree with you.

$update_status
);
Expand Down Expand Up @@ -2459,7 +2466,7 @@ public function column_version( $item ) {
* @since 2.2.0
*/
public function no_items() {
printf( wp_kses_post( __( 'No plugins to install, update or activate. <a href="%1$s">Return to the Dashboard</a>', 'tgmpa' ) ), esc_url( self_admin_url() ) );
echo wp_kses_post( esc_html__( 'No plugins to install, update or activate.', 'tgmpa' ) . ' <a href="' . esc_url( self_admin_url() ) . '"> ' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' );
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering that the strings are now concatenated and all individual bits are escaped, I think we can get rid of the wp_kses_post() wrapper.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks. If you could squash the commits, I'll merge it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Squash the commits??

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As all the changes in the PR are related, it makes more sense, having one commit containing them all, then having four different commits for it.
Squashing is a way to achive that.

See: http://makandracards.com/makandra/527-squash-several-git-commits-into-a-single-commit

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ramiy I'd really like to merge this. Any chance you can do the squash in the near future ? Thanks!

Let me know if you need any help with that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jrfnl can't squash this. I use SourceTree for windows, It does not support squash, only the mac version allow the squash.

Does it really matter if you merge one commit or four different commits?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't do it, I have issues with SourceTree terminal:

screenshot

Sorry guys...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ramiy Sorry to hear you're having trouble with this. The link I send you originally also contains a step by step example of how to do this manually if squash is not supported. Maybe that can help ?

echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>';
}

Expand Down Expand Up @@ -2528,16 +2535,19 @@ protected function get_row_actions( $item ) {

// Display the 'Install' action link if the plugin is not yet available.
if ( ! $this->tgmpa->is_plugin_installed( $item['slug'] ) ) {
$actions['install'] = _x( 'Install %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' );
/* translators: %s: plugin name in screen reader markup */
$actions['install'] = __( 'Install %s', 'tgmpa' );
} else {
// Display the 'Update' action link if an update is available and WP complies with plugin minimum.
if ( false !== $this->tgmpa->does_plugin_have_update( $item['slug'] ) && $this->tgmpa->can_plugin_update( $item['slug'] ) ) {
$actions['update'] = _x( 'Update %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' );
/* translators: %s: plugin name in screen reader markup */
$actions['update'] = __( 'Update %s', 'tgmpa' );
}

// Display the 'Activate' action link, but only if the plugin meets the minimum version.
if ( $this->tgmpa->can_plugin_activate( $item['slug'] ) ) {
$actions['activate'] = _x( 'Activate %2$s', '%2$s = plugin name in screen reader markup', 'tgmpa' );
/* translators: %s: plugin name in screen reader markup */
$actions['activate'] = __( 'Activate %s', 'tgmpa' );
}
}

Expand Down