Making WordPress.org

Opened 6 months ago

Closed 6 months ago

#8251 closed enhancement (fixed)

Ranked by impact, last %d days. should use _n()

Reported by: iworks Owned by: yani.iliev
Priority: low Milestone:
Component: Make (Get Involved) / P2 Keywords: has-patch
Cc:

Description (last modified by dd32)

File: wordpress.org/public_html/wp-content/themes/pub/wporg-breathe-2024/page-pledges.php

translation:

__( 'Ranked by impact, last %d days.', 'wporg-5ftf' ),

Should use _n() instead __():

_n( 'Ranked by impact, last %d day.', 'Ranked by impact, last %d days.', $window_days 'wporg-5ftf' ),

Attachments (1)

8251.diff​ (189 bytes ) - added by iworks 6 months ago.

Download all attachments as: .zip

Change History (4)

#1 @dd32
6 months ago

  • Component General → Make (Get Involved) / P2
  • Description modified (diff)
  • Owner set to yani.iliev
  • Status new → assigned

Generally we also use number_format_i18n() as well, which then requires %s be used to account for ,, ., (which are generally only present for >1k)

This ticket was mentioned in ​PR #648 on ​WordPress/wordpress.org by ​@yani.iliev.


6 months ago
#2

## Summary

The Ranked by impact, last %d days. label on /pledges/ was wrapped in __(), which forces every translation to treat the day count as plural. Switch to _n() with a singular form (Ranked by impact, last %d day.) so locales that distinguish 1 vs N can render the singular when \$window_days is 1, and existing plural-aware locales keep the plural for 30/90/180.

Props iworks, dd32.

Fixes https://meta.trac.wordpress.org/ticket/8251.

## Test plan

  • [ ] On /pledges/?window=30 (or 90 / 180): label reads "Ranked by impact, last 30 days." — unchanged.
  • [ ] If WINDOW_DAYS_ALLOWED ever adds 1 (or any locale renders different plural forms for these counts): the singular form is now available to translators.

#3 @yani.iliev
6 months ago

  • Resolution → fixed
  • Status assigned → closed

In 14914:

Make (Get Involved) / P2: Five for the Future: Use _n() for the /pledges/ ranked-by-impact label

Props yaniiliev, iworks, dd32.
Closes ​https://github.com/WordPress/wordpress.org/pull/648.
Fixes #8251.

Note: See TracTickets for help on using tickets.