WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 2 weeks ago

#14981 new defect (bug)

Provide a context for post statuses

Reported by: xibe Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.1
Component: I18N Keywords: good-first-bug has-patch dev-feedback
Focuses: Cc:

Description

1) /wp-admin/nav-menus.php: the "Most Recent" string (/wp-admin/includes/nav-menu.php:645) should be separated between the Pages context and the Articles context, since they can take different forms according to the language (i.e.: in French, "Articles" is masculine, "Pages" is feminine.

2) /wp-admin/edit.php: Same contextual need for "All", "Published", "Scheduled" and the rest of the per-status selector, for posts and articles (and others...).

Attachments (3)

14981.patch (9.5 KB) - added by rockwell15 3 weeks ago.
Patch for #14981
14981.1.patch (12.2 KB) - added by rockwell15 3 weeks ago.
Added post statuses, nav menu filters, & table view labels to get_post_type_labels()
14981.2.patch (12.7 KB) - added by rockwell15 3 weeks ago.
I think this patch addresses everything!

Download all attachments as: .zip

Change History (33)

#1 @RanYanivHartstein
5 years ago

  • Cc ran@… added

+1 for this, the need exists for the Hebrew translation as well.

#2 @westi
5 years ago

  • Keywords 3.2-early added
  • Milestone changed from Awaiting Review to Future Release

Both of these improvement require a fair few changes.

The strings for the Post Statuses have context of "Post" but get used for all Post Types.

Marking as a 3.2 candidate

#3 @ocean90
5 years ago

  • Keywords needs-patch added

#4 @xibe
4 years ago

  • Keywords 3.2-early removed
  • Version changed from 3.0.1 to 3.3.1

Still an issue in 3.4-alpha.

#5 @chriscct7
16 months ago

Still a valid issue in 4.0

#6 @cfoellmann
15 months ago

A list of affected strings in context must be compiled by multiple people speaking different languages presenting these "irregularities"

#8 @cfoellmann
15 months ago

  • Version set to trunk

#9 @johnbillion
14 months ago

  • Version changed from trunk to 3.1

The version field indicates the first version in which the issue was present.

#10 @swissspidy
2 months ago

  • Keywords good-first-bug added

#11 follow-up: @iworks
2 months ago

It should be like this:

switch( $post_type_name ) {
   case 'post':
       _ex( 'Most Recent', 'post' );
       break;
   case 'page':
       _ex( 'Most Recent', 'page' );
       break;
   default:
       _e( 'Most Recent' );
       break;
}

or can be like this:

_ex( 'Most Recent', $post_type_name );

#12 in reply to: ↑ 11 ; follow-up: @ocean90
2 months ago

Replying to iworks:

or can be like this:

_ex( 'Most Recent', $post_type_name );

No, variables are not supported as a context parameter.

#13 in reply to: ↑ 12 @iworks
2 months ago

Replying to ocean90:

Replying to iworks:

or can be like this:

_ex( 'Most Recent', $post_type_name );

No, variables are not supported as a context parameter.

I expected this answer ;-)

#14 @swissspidy
2 months ago

Since variables are not supported for context and the labels are indeed different for different post types (as noted by OP), what about adding this to get_post_type_labels()?

This ticket was mentioned in Slack in #polyglots by ocean90. View the logs.


4 weeks ago

#16 @fxbenard
4 weeks ago

Bump it up. Time to solve it. A 5 year old ticket ;)

#17 follow-up: @ocean90
4 weeks ago

  • Summary changed from Two i18n misses to Provide a context for post statuses

#18 in reply to: ↑ 17 @xibe
4 weeks ago

Replying to ocean90: Thank you, it is indeed much clearer this way :)

@rockwell15
3 weeks ago

Patch for #14981

#19 @rockwell15
3 weeks ago

  • Keywords has-patch added; needs-patch removed

#20 follow-up: @swissspidy
3 weeks ago

Thanks for the patch, @rockwell15!

Just note that not only the post statuses should be post type labels, but also the other mentioned strings like __( 'Search' ), __( 'View All' ) and __( 'Most Recent' ).

Also, we usually use yoda conditions, i.e. if( 'private' === $post->post_status ) {...} instead of if( $post->post_status == 'private' ) {...}

#21 in reply to: ↑ 20 ; follow-up: @rockwell15
3 weeks ago

Replying to swissspidy:

Thanks for the patch, @rockwell15!

Just note that not only the post statuses should be post type labels, but also the other mentioned strings like __( 'Search' ), __( 'View All' ) and __( 'Most Recent' ).

Also, we usually use yoda conditions, i.e. if( 'private' === $post->post_status ) {...} instead of if( $post->post_status == 'private' ) {...}

Ok, I'll fix the conditions format.

I didn't add those 3 strings you mentioned to get_post_type_labels() since those only appear once regarding post type (wp-admin/includes/nav-menu.php ~ line 382), so I thought it unnecessary for that function to fetch them every time it is called. You think I should add them to get_post_type_labels() though?

#22 in reply to: ↑ 21 @swissspidy
3 weeks ago

  • Keywords needs-refresh added

Replying to rockwell15:

I didn't add those 3 strings you mentioned to get_post_type_labels() since those only appear once regarding post type (wp-admin/includes/nav-menu.php ~ line 382), so I thought it unnecessary for that function to fetch them every time it is called. You think I should add them to get_post_type_labels() though?

Yes!

Again, that's what has been reported originally. These strings can be translated differently per post type. Just separating posts and pages is not enough. There are other post types as well.

#24 in reply to: ↑ 23 @rockwell15
3 weeks ago

Ok, thanks for clarification. I'll get on that.

Replying to ocean90:

The patch needs to cover the table views trunk/src/wp-admin/includes/class-wp-posts-list-table.php@35901#L264 too.

What table views are you referring to exactly, the 'Mine', 'All', and 'Sticky'?

Last edited 3 weeks ago by rockwell15 (previous) (diff)

@rockwell15
3 weeks ago

Added post statuses, nav menu filters, & table view labels to get_post_type_labels()

#25 in reply to: ↑ 23 ; follow-up: @fxbenard
3 weeks ago

Replying to ocean90:

The patch needs to cover the table views trunk/src/wp-admin/includes/class-wp-posts-list-table.php@35901#L264 too.

In French like edit/ quick edit/ trash/ view are verbs, no need to translate them differently

#26 in reply to: ↑ 25 ; follow-up: @ocean90
3 weeks ago

Replying to fxbenard:

In French like edit/ quick edit/ trash/ view are verbs, no need to translate them differently

I'm talking about "All", "Pending" or "Mine".

#27 in reply to: ↑ 26 @fxbenard
3 weeks ago

Replying to ocean90:

I'm talking about "All", "Pending" or "Mine".

All > Tous or Toutes
Pending > En attente
Mine > Le mien or La mienne

Yes it's needed

@rockwell15
3 weeks ago

I think this patch addresses everything!

#28 @rockwell15
3 weeks ago

  • Keywords needs-refresh removed

#29 @rockwell15
2 weeks ago

  • Keywords dev-feedback added

#30 @SergeyBiryukov
2 weeks ago

#35056 was marked as a duplicate.

Note: See TracTickets for help on using tickets.