Make WordPress Core

Changeset 59494


Ignore:
Timestamp:
12/05/2024 09:35:40 PM (21 months ago)
Author:
swissspidy
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-locale.php

    r58200 r59494  
    338338
    339339        /**
     340         * Retrieves translated version of month genitive string.
     341         *
     342         * The $month_number parameter has to be a string
     343         * because it must have the '0' in front of any number
     344         * that is less than 10. Starts from '01' and ends at
     345         * '12'.
     346         *
     347         * You can use an integer instead and it will add the
     348         * '0' before the numbers less than 10 for you.
     349         *
     350         * @since 6.8.0
     351         *
     352         * @param string|int $month_number '01' through '12'.
     353         * @return string Translated genitive month name.
     354         */
     355        public function get_month_genitive( $month_number ) {
     356                return $this->month_genitive[ zeroise( $month_number, 2 ) ];
     357        }
     358
     359        /**
    340360         * Retrieves translated version of meridiem string.
    341361         *
Note: See TracChangeset for help on using the changeset viewer.