-
Notifications
You must be signed in to change notification settings - Fork 427
Fix i18n functions #516
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
Changes from 4 commits
393003f
b9bd0d6
e8d2d7b
203cb43
c7cb342
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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' ), | ||
|
|
@@ -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>'; | ||
| } | ||
|
|
||
|
|
@@ -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, | ||
| $update_status | ||
| ); | ||
|
|
@@ -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>' ); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Awesome! Thanks. If you could squash the commits, I'll merge it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Squash the commits??
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. See: http://makandracards.com/makandra/527-squash-several-git-commits-into-a-single-commit
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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>'; | ||
| } | ||
|
|
||
|
|
@@ -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' ); | ||
| } | ||
| } | ||
|
|
||
|
|
||

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.
@jrfnl,
The context is used to describe the entire string, translators comment are used to describe specific placeholders like
%s,%1$s,%2$sand 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.