Skip to content

Commit

Permalink
I18N: Add new WP_Locale::get_month_genitive() method.
Browse files Browse the repository at this point in the history
Complements existing helper methods such as `WP_Locale::get_month_abbrev()`.

Props ankitkumarshah, Tkama, SergeyBiryukov.
Fixes #58658.

git-svn-id: https://develop.svn.wordpress.org/trunk@59494 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
swissspidy committed Dec 5, 2024
1 parent 9c7d008 commit 59a6b5e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/wp-includes/class-wp-locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,26 @@ public function get_month_abbrev( $month_name ) {
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.
*
Expand Down

0 comments on commit 59a6b5e

Please sign in to comment.