wp/wp-includes/class-wp-locale.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
--- a/wp/wp-includes/class-wp-locale.php	Wed Sep 21 18:19:35 2022 +0200
+++ b/wp/wp-includes/class-wp-locale.php	Tue Sep 27 16:37:53 2022 +0200
@@ -18,7 +18,7 @@
 	 * Stores the translated strings for the full weekday names.
 	 *
 	 * @since 2.1.0
-	 * @var array
+	 * @var string[]
 	 */
 	public $weekday;
 
@@ -31,7 +31,7 @@
 	 * @see WP_Locale::init() for how to handle the hack.
 	 *
 	 * @since 2.1.0
-	 * @var array
+	 * @var string[]
 	 */
 	public $weekday_initial;
 
@@ -39,7 +39,7 @@
 	 * Stores the translated strings for the abbreviated weekday names.
 	 *
 	 * @since 2.1.0
-	 * @var array
+	 * @var string[]
 	 */
 	public $weekday_abbrev;
 
@@ -47,7 +47,7 @@
 	 * Stores the translated strings for the full month names.
 	 *
 	 * @since 2.1.0
-	 * @var array
+	 * @var string[]
 	 */
 	public $month;
 
@@ -55,7 +55,7 @@
 	 * Stores the translated strings for the month names in genitive case, if the locale specifies.
 	 *
 	 * @since 4.4.0
-	 * @var array
+	 * @var string[]
 	 */
 	public $month_genitive;
 
@@ -63,7 +63,7 @@
 	 * Stores the translated strings for the abbreviated month names.
 	 *
 	 * @since 2.1.0
-	 * @var array
+	 * @var string[]
 	 */
 	public $month_abbrev;
 
@@ -73,7 +73,7 @@
 	 * Also the capitalized versions.
 	 *
 	 * @since 2.1.0
-	 * @var array
+	 * @var string[]
 	 */
 	public $meridiem;
 
@@ -96,6 +96,14 @@
 	public $number_format;
 
 	/**
+	 * The separator string used for localizing list item separator.
+	 *
+	 * @since 6.0.0
+	 * @var string
+	 */
+	public $list_item_separator;
+
+	/**
 	 * Constructor which calls helper methods to set up object variables.
 	 *
 	 * @since 2.1.0
@@ -128,22 +136,22 @@
 		$this->weekday[6] = /* translators: Weekday. */ __( 'Saturday' );
 
 		// The first letter of each day.
-		$this->weekday_initial[ __( 'Sunday' ) ]    = /* translators: One-letter abbreviation of the weekday. */ _x( 'S', 'Sunday initial' );
-		$this->weekday_initial[ __( 'Monday' ) ]    = /* translators: One-letter abbreviation of the weekday. */ _x( 'M', 'Monday initial' );
-		$this->weekday_initial[ __( 'Tuesday' ) ]   = /* translators: One-letter abbreviation of the weekday. */ _x( 'T', 'Tuesday initial' );
-		$this->weekday_initial[ __( 'Wednesday' ) ] = /* translators: One-letter abbreviation of the weekday. */ _x( 'W', 'Wednesday initial' );
-		$this->weekday_initial[ __( 'Thursday' ) ]  = /* translators: One-letter abbreviation of the weekday. */ _x( 'T', 'Thursday initial' );
-		$this->weekday_initial[ __( 'Friday' ) ]    = /* translators: One-letter abbreviation of the weekday. */ _x( 'F', 'Friday initial' );
-		$this->weekday_initial[ __( 'Saturday' ) ]  = /* translators: One-letter abbreviation of the weekday. */ _x( 'S', 'Saturday initial' );
+		$this->weekday_initial[ $this->weekday[0] ] = /* translators: One-letter abbreviation of the weekday. */ _x( 'S', 'Sunday initial' );
+		$this->weekday_initial[ $this->weekday[1] ] = /* translators: One-letter abbreviation of the weekday. */ _x( 'M', 'Monday initial' );
+		$this->weekday_initial[ $this->weekday[2] ] = /* translators: One-letter abbreviation of the weekday. */ _x( 'T', 'Tuesday initial' );
+		$this->weekday_initial[ $this->weekday[3] ] = /* translators: One-letter abbreviation of the weekday. */ _x( 'W', 'Wednesday initial' );
+		$this->weekday_initial[ $this->weekday[4] ] = /* translators: One-letter abbreviation of the weekday. */ _x( 'T', 'Thursday initial' );
+		$this->weekday_initial[ $this->weekday[5] ] = /* translators: One-letter abbreviation of the weekday. */ _x( 'F', 'Friday initial' );
+		$this->weekday_initial[ $this->weekday[6] ] = /* translators: One-letter abbreviation of the weekday. */ _x( 'S', 'Saturday initial' );
 
 		// Abbreviations for each day.
-		$this->weekday_abbrev[ __( 'Sunday' ) ]    = /* translators: Three-letter abbreviation of the weekday. */ __( 'Sun' );
-		$this->weekday_abbrev[ __( 'Monday' ) ]    = /* translators: Ttree-letter abbreviation of the weekday. */ __( 'Mon' );
-		$this->weekday_abbrev[ __( 'Tuesday' ) ]   = /* translators: Three-letter abbreviation of the weekday. */ __( 'Tue' );
-		$this->weekday_abbrev[ __( 'Wednesday' ) ] = /* translators: Three-letter abbreviation of the weekday. */ __( 'Wed' );
-		$this->weekday_abbrev[ __( 'Thursday' ) ]  = /* translators: Three-letter abbreviation of the weekday. */ __( 'Thu' );
-		$this->weekday_abbrev[ __( 'Friday' ) ]    = /* translators: Three-letter abbreviation of the weekday. */ __( 'Fri' );
-		$this->weekday_abbrev[ __( 'Saturday' ) ]  = /* translators: Three-letter abbreviation of the weekday. */ __( 'Sat' );
+		$this->weekday_abbrev[ $this->weekday[0] ] = /* translators: Three-letter abbreviation of the weekday. */ __( 'Sun' );
+		$this->weekday_abbrev[ $this->weekday[1] ] = /* translators: Three-letter abbreviation of the weekday. */ __( 'Mon' );
+		$this->weekday_abbrev[ $this->weekday[2] ] = /* translators: Three-letter abbreviation of the weekday. */ __( 'Tue' );
+		$this->weekday_abbrev[ $this->weekday[3] ] = /* translators: Three-letter abbreviation of the weekday. */ __( 'Wed' );
+		$this->weekday_abbrev[ $this->weekday[4] ] = /* translators: Three-letter abbreviation of the weekday. */ __( 'Thu' );
+		$this->weekday_abbrev[ $this->weekday[5] ] = /* translators: Three-letter abbreviation of the weekday. */ __( 'Fri' );
+		$this->weekday_abbrev[ $this->weekday[6] ] = /* translators: Three-letter abbreviation of the weekday. */ __( 'Sat' );
 
 		// The months.
 		$this->month['01'] = /* translators: Month name. */ __( 'January' );
@@ -174,18 +182,18 @@
 		$this->month_genitive['12'] = /* translators: Month name, genitive. */ _x( 'December', 'genitive' );
 
 		// Abbreviations for each month.
-		$this->month_abbrev[ __( 'January' ) ]   = /* translators: Three-letter abbreviation of the month. */ _x( 'Jan', 'January abbreviation' );
-		$this->month_abbrev[ __( 'February' ) ]  = /* translators: Three-letter abbreviation of the month. */ _x( 'Feb', 'February abbreviation' );
-		$this->month_abbrev[ __( 'March' ) ]     = /* translators: Three-letter abbreviation of the month. */ _x( 'Mar', 'March abbreviation' );
-		$this->month_abbrev[ __( 'April' ) ]     = /* translators: Three-letter abbreviation of the month. */ _x( 'Apr', 'April abbreviation' );
-		$this->month_abbrev[ __( 'May' ) ]       = /* translators: Three-letter abbreviation of the month. */ _x( 'May', 'May abbreviation' );
-		$this->month_abbrev[ __( 'June' ) ]      = /* translators: Three-letter abbreviation of the month. */ _x( 'Jun', 'June abbreviation' );
-		$this->month_abbrev[ __( 'July' ) ]      = /* translators: Three-letter abbreviation of the month. */ _x( 'Jul', 'July abbreviation' );
-		$this->month_abbrev[ __( 'August' ) ]    = /* translators: Three-letter abbreviation of the month. */ _x( 'Aug', 'August abbreviation' );
-		$this->month_abbrev[ __( 'September' ) ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Sep', 'September abbreviation' );
-		$this->month_abbrev[ __( 'October' ) ]   = /* translators: Three-letter abbreviation of the month. */ _x( 'Oct', 'October abbreviation' );
-		$this->month_abbrev[ __( 'November' ) ]  = /* translators: Three-letter abbreviation of the month. */ _x( 'Nov', 'November abbreviation' );
-		$this->month_abbrev[ __( 'December' ) ]  = /* translators: Three-letter abbreviation of the month. */ _x( 'Dec', 'December abbreviation' );
+		$this->month_abbrev[ $this->month['01'] ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Jan', 'January abbreviation' );
+		$this->month_abbrev[ $this->month['02'] ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Feb', 'February abbreviation' );
+		$this->month_abbrev[ $this->month['03'] ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Mar', 'March abbreviation' );
+		$this->month_abbrev[ $this->month['04'] ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Apr', 'April abbreviation' );
+		$this->month_abbrev[ $this->month['05'] ] = /* translators: Three-letter abbreviation of the month. */ _x( 'May', 'May abbreviation' );
+		$this->month_abbrev[ $this->month['06'] ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Jun', 'June abbreviation' );
+		$this->month_abbrev[ $this->month['07'] ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Jul', 'July abbreviation' );
+		$this->month_abbrev[ $this->month['08'] ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Aug', 'August abbreviation' );
+		$this->month_abbrev[ $this->month['09'] ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Sep', 'September abbreviation' );
+		$this->month_abbrev[ $this->month['10'] ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Oct', 'October abbreviation' );
+		$this->month_abbrev[ $this->month['11'] ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Nov', 'November abbreviation' );
+		$this->month_abbrev[ $this->month['12'] ] = /* translators: Three-letter abbreviation of the month. */ _x( 'Dec', 'December abbreviation' );
 
 		// The meridiems.
 		$this->meridiem['am'] = __( 'am' );
@@ -209,6 +217,9 @@
 
 		$this->number_format['decimal_point'] = ( 'number_format_decimal_point' === $decimal_point ) ? '.' : $decimal_point;
 
+		/* translators: used between list items, there is a space after the comma */
+		$this->list_item_separator = __( ', ' );
+
 		// Set text direction.
 		if ( isset( $GLOBALS['text_direction'] ) ) {
 			$this->text_direction = $GLOBALS['text_direction'];
@@ -220,7 +231,7 @@
 	}
 
 	/**
-	 * Retrieve the full translated weekday word.
+	 * Retrieves the full translated weekday word.
 	 *
 	 * Week starts on translated Sunday and can be fetched
 	 * by using 0 (zero). So the week starts with 0 (zero)
@@ -236,7 +247,7 @@
 	}
 
 	/**
-	 * Retrieve the translated weekday initial.
+	 * Retrieves the translated weekday initial.
 	 *
 	 * The weekday initial is retrieved by the translated
 	 * full weekday word. When translating the weekday initial
@@ -253,7 +264,7 @@
 	}
 
 	/**
-	 * Retrieve the translated weekday abbreviation.
+	 * Retrieves the translated weekday abbreviation.
 	 *
 	 * The weekday abbreviation is retrieved by the translated
 	 * full weekday word.
@@ -268,7 +279,7 @@
 	}
 
 	/**
-	 * Retrieve the full translated month by month number.
+	 * Retrieves the full translated month by month number.
 	 *
 	 * The $month_number parameter has to be a string
 	 * because it must have the '0' in front of any number
@@ -288,7 +299,7 @@
 	}
 
 	/**
-	 * Retrieve translated version of month abbreviation string.
+	 * Retrieves translated version of month abbreviation string.
 	 *
 	 * The $month_name parameter is expected to be the translated or
 	 * translatable version of the month.
@@ -303,7 +314,7 @@
 	}
 
 	/**
-	 * Retrieve translated version of meridiem string.
+	 * Retrieves translated version of meridiem string.
 	 *
 	 * The $meridiem parameter is expected to not be translated.
 	 *
@@ -350,7 +361,7 @@
 	}
 
 	/**
-	 * Register date/time format strings for general POT.
+	 * Registers date/time format strings for general POT.
 	 *
 	 * Private, unused method to add some date/time formats translated
 	 * on wp-admin/options-general.php to the general POT that would
@@ -366,4 +377,15 @@
 		/* translators: Localized date and time format, see https://www.php.net/manual/datetime.format.php */
 		__( 'F j, Y g:i a' );
 	}
+
+	/**
+	 * Retrieves the localized list item separator.
+	 *
+	 * @since 6.0.0
+	 *
+	 * @return string Localized list item separator.
+	 */
+	public function get_list_item_separator() {
+		return $this->list_item_separator;
+	}
 }