From 30a77d5fa4b7e3cb1c6b3bf25337af691839fa99 Mon Sep 17 00:00:00 2001 From: audrasjb Date: Sun, 13 Mar 2022 20:03:01 +0000 Subject: [PATCH] i18n: Define List item separator as a WP_Locale property. The list item separator is a locale property, and it doesn't make much sense to translate it separately in multiple projects. This changeset implements the following modifications: - Define list item separator as a new WP_Locale property - Add `wp_get_list_item_separator()` as a wrapper for `WP_Locale::get_list_item_separator` - Replace `$wp_locale->get_list_item_separator()` calls with `wp_get_list_item_separator()` - Added a compatibility layer for bundled themes Props SergeyBiryukov, swissspidy, rsiddharth, johnbillion, audrasjb. Fixes #39733. Built from https://develop.svn.wordpress.org/trunk@52929 git-svn-id: http://core.svn.wordpress.org/trunk@52518 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../includes/class-wp-media-list-table.php | 3 +-- .../includes/class-wp-posts-list-table.php | 3 +-- .../themes/twentyeleven/content-featured.php | 6 ++--- .../themes/twentyeleven/content-gallery.php | 6 ++--- .../themes/twentyeleven/content-image.php | 6 ++--- .../themes/twentyeleven/content-quote.php | 6 ++--- .../themes/twentyeleven/content-single.php | 6 ++--- wp-content/themes/twentyeleven/content.php | 6 ++--- wp-content/themes/twentyeleven/functions.php | 14 ++++++++++++ .../themes/twentynineteen/functions.php | 14 ++++++++++++ .../twentynineteen/inc/template-tags.php | 6 ++--- .../themes/twentyseventeen/functions.php | 14 ++++++++++++ .../twentyseventeen/inc/template-tags.php | 3 +-- .../themes/twentythirteen/functions.php | 20 +++++++++++++---- wp-content/themes/twentytwelve/functions.php | 20 +++++++++++++---- .../themes/twentytwentyone/functions.php | 14 ++++++++++++ .../twentytwentyone/inc/template-tags.php | 12 ++++------ wp-includes/class-wp-locale.php | 22 +++++++++++++++++++ wp-includes/class-wp-theme.php | 3 +-- wp-includes/functions.php | 14 ++++++++++++ wp-includes/version.php | 2 +- 21 files changed, 147 insertions(+), 53 deletions(-) diff --git a/wp-admin/includes/class-wp-media-list-table.php b/wp-admin/includes/class-wp-media-list-table.php index d1234929c4..e1fa4058cc 100644 --- a/wp-admin/includes/class-wp-media-list-table.php +++ b/wp-admin/includes/class-wp-media-list-table.php @@ -633,8 +633,7 @@ class WP_Media_List_Table extends WP_List_Table { esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) ) ); } - /* translators: Used between list items, there is a space after the comma. */ - echo implode( __( ', ' ), $out ); + echo implode( wp_get_list_item_separator(), $out ); } else { echo '' . get_taxonomy( $taxonomy )->labels->no_terms . ''; } diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php index 639bed1da4..96b3adb06b 100644 --- a/wp-admin/includes/class-wp-posts-list-table.php +++ b/wp-admin/includes/class-wp-posts-list-table.php @@ -1294,8 +1294,7 @@ class WP_Posts_List_Table extends WP_List_Table { */ $term_links = apply_filters( 'post_column_taxonomy_links', $term_links, $taxonomy, $terms ); - /* translators: Used between list items, there is a space after the comma. */ - echo implode( __( ', ' ), $term_links ); + echo implode( wp_get_list_item_separator(), $term_links ); } else { echo '' . $taxonomy_object->labels->no_terms . ''; } diff --git a/wp-content/themes/twentyeleven/content-featured.php b/wp-content/themes/twentyeleven/content-featured.php index 3ba761dc19..b49f680454 100644 --- a/wp-content/themes/twentyeleven/content-featured.php +++ b/wp-content/themes/twentyeleven/content-featured.php @@ -32,8 +32,7 @@ global $feature_class;