WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

Last modified 4 years ago

#26066 closed defect (bug) (fixed)

Invalid i18n in Site Content dashboard widget

Reported by: SergeyBiryukov Owned by: nacin
Milestone: 3.8 Priority: high
Severity: normal Version: 3.8
Component: I18N Keywords: has-patch
Focuses: Cc:

Description

'%s Posts', '%s Pages' is not localizable, as noted previously in ticket:17609:3 and #19099.

Unfortunately, that's exactly what the new Site Content dashboard widget does (see #25824).

Are we going to allow custom post types in the widget in 3.8? If yes, we need to figure out a way to make it localizable, probably with a new set of post type labels.

I'd suggest sticking with posts and pages for now, and continue to avoid post type and taxonomy names in generic strings until we have a way to do the i18n properly.

Attachments (3)

26066.patch (1.5 KB) - added by SergeyBiryukov 6 years ago.
26066.diff (1.8 KB) - added by kovshenin 5 years ago.
26066.2.patch (3.4 KB) - added by dimadin 5 years ago.

Download all attachments as: .zip

Change History (14)

#1 @SergeyBiryukov
6 years ago

26066.patch also fixes an incorrect argument passed to _n() for the 'in moderation' text (a copy/paste error in [26144]).

#2 @SergeyBiryukov
6 years ago

Are we going to allow custom post types in the widget in 3.8? If yes, we need to figure out a way to make it localizable, probably with a new set of post type labels.

One potential option would be to allow translators to change the word order and add colons (like in ticket:25459:25459.2.diff for #25459), so the strings would become: 'Posts: %s', 'Pages: %s', 'Books: %s', etc.

#3 @SergeyBiryukov
5 years ago

#26303 was marked as a duplicate.

#4 @pavelevap
5 years ago

There are Posts and Pages (with capitalized letters) x comments and in moderation (with small letters)?

@kovshenin
5 years ago

#5 @kovshenin
5 years ago

26066.diff adds a new num_items label to register_post_type. To make use of the new label, a custom post type would use something like:

register_post_type( 'test', array(
    'public' => true,
    ...
    'labels' => array(
        ...
        'num_items' => _n_noop( '%s item', '%s items' )
    ),
) );

Unfortunately for all existing post types that don't define the num_items label, the Site Content widget will show "x posts" or "x pages". I also believe this is not the only good use case for the new label.

@dimadin
5 years ago

#6 @dimadin
5 years ago

26066.2.patch is a first try at fixing thing mentioned in 25824#comment:14

#7 @nacin
5 years ago

  • Keywords commit added

Decision time. Let's reduce this to whatever it was in 3.7. That means posts and pages only (no custom post types). Sounds like 26066.patch?

#8 @nacin
5 years ago

  • Keywords commit removed
  • Priority changed from normal to high

Okay, so there are other issues, which attempt to be covered by 26066.2.patch.

#9 @nacin
5 years ago

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

In 26704:

Fix various i18n issues on the dashboard. Limits it to posts and pages only for 3.8.

props SergeyBiryukov, dimadin.
fixes #26066.

#10 @nacin
5 years ago

In 26741:

Dashboard: Restore a line that vanished from my editor to print recently published posts. Also fix an off-by-one error.

see [26704]. see #26066.

This ticket was mentioned in Slack in #core by sergeybiryukov. View the logs.


4 years ago

Note: See TracTickets for help on using tickets.