-
Notifications
You must be signed in to change notification settings - Fork 430
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
Fix i18n functions #516
Fix i18n functions #516
Conversation
Hi @ramiy Nice one! Thank you. |
@@ -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 */ | |||
__( '%1$s, %2$s', 'tgmpa' ), | |||
$install_status, |
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.
As this 'string' is so generic, should it not have a translators comment and a context through _x ?
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.
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.
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.
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.
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.
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.
It's a very good point. I agree with you.
I'm +1 for everything happening here. I was aware that |
@@ -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>' ); |
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.
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.
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.
Done.
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.
Awesome! Thanks. If you could squash the commits, I'll merge it.
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.
Squash the commits??
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.
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
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.
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.
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.
@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?
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.
Do it on the command line then: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
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.
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 ?
In WordPress 4.4 we fixed many translation functions in the core. The same coding standards should be implemented in TGM too.