From 03a5e578d8242b24a1c1c03a2a98bfa90bbbf15c Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 5 Dec 2024 21:37:20 +0000 Subject: [PATCH] I18N: Add new `WP_Locale::get_month_genitive()` method. Complements existing helper methods such as `WP_Locale::get_month_abbrev()`. Props ankitkumarshah, Tkama, SergeyBiryukov. Fixes #58658. Built from https://develop.svn.wordpress.org/trunk@59494 git-svn-id: http://core.svn.wordpress.org/trunk@58880 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-locale.php | 20 ++++++++++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/wp-includes/class-wp-locale.php b/wp-includes/class-wp-locale.php index 87af36a2a4..a78617b5e3 100644 --- a/wp-includes/class-wp-locale.php +++ b/wp-includes/class-wp-locale.php @@ -336,6 +336,26 @@ class WP_Locale { return $this->month_abbrev[ $month_name ]; } + /** + * Retrieves translated version of month genitive string. + * + * The $month_number parameter has to be a string + * because it must have the '0' in front of any number + * that is less than 10. Starts from '01' and ends at + * '12'. + * + * You can use an integer instead and it will add the + * '0' before the numbers less than 10 for you. + * + * @since 6.8.0 + * + * @param string|int $month_number '01' through '12'. + * @return string Translated genitive month name. + */ + public function get_month_genitive( $month_number ) { + return $this->month_genitive[ zeroise( $month_number, 2 ) ]; + } + /** * Retrieves translated version of meridiem string. * diff --git a/wp-includes/version.php b/wp-includes/version.php index 7c413fafab..a115eeaa39 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.8-alpha-59493'; +$wp_version = '6.8-alpha-59494'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.