Make WordPress Core

Opened 5 years ago

Last modified 104 minutes ago

#39733 new enhancement

List item separator should be a WP_Locale property

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


Currently, some (most?) themes have a translatable list item separator for displaying a list of categories or tags. See an example in Twenty Seventeen:

/* translators: used between list items, there is a space after the comma */
$separate_meta = __( ', ', 'twentyseventeen' );

One of ru_RU translation team contributors made a point that list item separator is a locale property, and it doesn't make much sense to translate it separately in multiple projects.

We could probably add it as a property of WP_Locale class, in addition to ::number_format['thousands_sep'] and ::number_format['decimal_point'], and there should be a public function like number_format_i18n(), e.g. get_list_item_separator(), for plugins and themes to use. Thoughts?

Attachments (1)

39733.2021091800.patch (19.9 KB) - added by rsiddharth 107 minutes ago.
Initial version (2021091800)

Download all attachments as: .zip

Change History (4)

#1 @swissspidy
5 years ago

Sounds useful. Besides the default themes there are three instances of __( ', ' ) being used in core. Perhaps more when counting instances of implode( ', ', … ) that could make use of a translatable list item separator.

#2 @swissspidy
7 weeks ago

  • Keywords needs-patch good-first-bug added
  • Milestone changed from Awaiting Review to Future Release

107 minutes ago

Initial version (2021091800)

#3 @rsiddharth
104 minutes ago

  • Keywords has-patch added; needs-patch removed

@swissspidy @SergeyBiryukov I've uploaded the initial version of the patch.

Are you able to tell if I'm going in the correct direction?

Note: See TracTickets for help on using tickets.