Make WordPress Core


Ignore:
Timestamp:
03/13/2022 08:01:05 PM (3 years ago)
Author:
audrasjb
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentytwentyone/inc/template-tags.php

    r50233 r52929  
    101101                echo '<div class="post-taxonomies">';
    102102
    103                 /* translators: Used between list items, there is a space after the comma. */
    104                 $categories_list = get_the_category_list( __( ', ', 'twentytwentyone' ) );
     103                $categories_list = get_the_category_list( wp_get_list_item_separator() );
    105104                if ( $categories_list ) {
    106105                    printf(
     
    111110                }
    112111
    113                 /* translators: Used between list items, there is a space after the comma. */
    114                 $tags_list = get_the_tag_list( '', __( ', ', 'twentytwentyone' ) );
     112                $tags_list = get_the_tag_list( '', wp_get_list_item_separator() );
    115113                if ( $tags_list ) {
    116114                    printf(
     
    145143                echo '<div class="post-taxonomies">';
    146144
    147                 /* translators: Used between list items, there is a space after the comma. */
    148                 $categories_list = get_the_category_list( __( ', ', 'twentytwentyone' ) );
     145                $categories_list = get_the_category_list( wp_get_list_item_separator() );
    149146                if ( $categories_list ) {
    150147                    printf(
     
    155152                }
    156153
    157                 /* translators: Used between list items, there is a space after the comma. */
    158                 $tags_list = get_the_tag_list( '', __( ', ', 'twentytwentyone' ) );
     154                $tags_list = get_the_tag_list( '', wp_get_list_item_separator() );
    159155                if ( $tags_list ) {
    160156                    printf(
Note: See TracChangeset for help on using the changeset viewer.