Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#37895 closed defect (bug) (fixed)

Customizer: avoid post type names in generic strings

Reported by: afercia's profile afercia Owned by: westonruter's profile westonruter
Milestone: 4.7 Priority: normal
Severity: normal Version: 4.7
Component: Customize Keywords: has-patch
Focuses: Cc:

Description

See #34923.

The new functionality recently introduced in the Customizer to create new pages or posts from the menu items panel uses a string that is not translatable, due to structural differences in languages.

printf( __( 'Create New %s' ), $post_type_obj->labels->singular_name );

Languages other than English may need to translate "new" differently depending on the genre of the post type name. This should be either simplified or use one of the existing labels. Alternatively, if the word "Create" is considered essential, then a new post type label should be introduced.

Already existing labels:

'add_new_item' => array( __('Add New Post'), __('Add New Page') ),
'new_item' => array( __('New Post'), __('New Page') ),

See conversation on Slack:
https://wordpress.slack.com/archives/core-customize/p1472657230000390

A general good rule in WordPress is to avoid post type and taxonomy names in generic strings, for reference see:
https://core.trac.wordpress.org/ticket/17609#comment:3
https://core.trac.wordpress.org/ticket/19099#comment:1

Change History (3)

#1 @westonruter
8 years ago

  • Owner set to westonruter
  • Resolution set to fixed
  • Status changed from new to closed

In 38479:

Customize: Fix i18n by re-using the add_new_item post type label instead of using a post type name in a generic string.

Props afercia, westonruter.
See #34923.
Fixes #37895.

#2 follow-up: @westonruter
8 years ago

  • Keywords has-patch added; needs-patch removed

@afercia thanks very much for the education! Avrei dovuto conoscerlo meglio.

#3 in reply to: ↑ 2 @afercia
8 years ago

Replying to westonruter:

Avrei dovuto conoscerlo meglio.

🇮🇹

Note: See TracTickets for help on using tickets.