WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#16998 closed defect (bug) (fixed)

Default Link Label on Next and Previous Links Functions not Tanslated

Reported by: CharlesClarkson Owned by:
Milestone: 3.2 Priority: normal
Severity: normal Version:
Component: I18N Keywords: has-patch dev-feedback
Focuses: Cc:

Description

The default link $label parameter on these Previous/Next posts functions is not translatable.

get_next_posts_link()
next_posts_link()
get_previous_posts_link()
previous_posts_link()

The path handles the label text the same way as the comment Previous/Next links in the same file (/wp-includes/link-template.php).

This patch might break a plugin or theme which relies on passing in the function call. I'm not sure why anyone would do that to a link text label, but ...

Attachments (3)

16998.diff (2.2 KB) - added by CharlesClarkson 3 years ago.
16998.2.diff (1.7 KB) - added by nathanrice 3 years ago.
Translate $label, use null and is_null for backward compatibility
16998.3.diff (1.7 KB) - added by nathanrice 3 years ago.
Translate $label, use null and a strict check for backward compatibility

Download all attachments as: .zip

Change History (8)

CharlesClarkson3 years ago

comment:1 CharlesClarkson3 years ago

This patch might break a plugin or theme which relies on passing an empty string in the function call. I'm not sure why anyone would do that to a link text label, but ...

get_next_posts_link('')

comment:2 nathanrice3 years ago

  • Cc ncrice@… added
  • Component changed from General to I18N
  • Keywords has-patch dev-feedback added

+1

Having the default text non-translatable is bad form for international users, and places the burden on theme developers to pass their own translatable text to these functions in order to use them properly.

comment:3 nacin3 years ago

  • Milestone changed from Awaiting Review to 3.2

We can change this to null as the default. Then a strict check would avoid any edge cases with an empty string.

nathanrice3 years ago

Translate $label, use null and is_null for backward compatibility

nathanrice3 years ago

Translate $label, use null and a strict check for backward compatibility

comment:4 ryan3 years ago

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

(In [17728]) Translate default link labels for *posts_link(). Props nathanrice, CharlesClarkson. fixes #16998

comment:5 ryan3 years ago

I tweaked the patches a bit to do null === like we do elsewhere for default labels.

Note: See TracTickets for help on using tickets.