Skip to content
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

Merged
merged 5 commits into from
Apr 19, 2016
Merged

Fix i18n functions #516

merged 5 commits into from
Apr 19, 2016

Conversation

ramiy
Copy link
Contributor

@ramiy ramiy commented Jan 9, 2016

In WordPress 4.4 we fixed many translation functions in the core. The same coding standards should be implemented in TGM too.

@jrfnl
Copy link
Contributor

jrfnl commented Jan 9, 2016

Hi @ramiy Nice one! Thank you.
I'll look through it in detail in a moment.

@@ -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,
Copy link
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
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
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
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.

@GaryJones
Copy link
Member

I'm +1 for everything happening here. I was aware that _x ≠ translator comment, but hadn't had time to go through it, so thank you @ramiy!

@@ -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
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
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
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
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
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
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
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
Member

Choose a reason for hiding this comment

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

Copy link
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
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 ?

@GaryJones GaryJones merged commit 88e8b1b into TGMPA:develop Apr 19, 2016
jrfnl added a commit that referenced this pull request May 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants