WP_Locale
- Since
- 2.1.0, 4.6.0
- Source
wp-includes/class-wp-locale.php:16
Core class used to store translated data for a locale.
Compatibility
- WordPress
- since 4.6.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Properties · 11
$weekdaystring[]public- Stores the translated strings for the full weekday names.
$weekday_initialstring[]public- Stores the translated strings for the one character weekday names.
$weekday_abbrevstring[]public- Stores the translated strings for the abbreviated weekday names.
$monthstring[]public- Stores the translated strings for the full month names.
$month_genitivestring[]public- Stores the translated strings for the month names in genitive case, if the locale specifies.
$month_abbrevstring[]public- Stores the translated strings for the abbreviated month names.
$meridiemstring[]public- Stores the translated strings for 'am' and 'pm'.
$text_directionstringpublic- The text direction of the locale language.
$number_formatarraypublic- The thousands separator and decimal point values used for localizing numbers.
$list_item_separatorstringpublic- The separator string used for localizing list item separator.
$word_count_typestringpublic- The word count type of the locale language.
Methods · 14
- __construct()Constructor which calls helper methods to set up object variables.
- init()Sets up the translated strings and object properties.
- get_weekday()Retrieves the full translated weekday word.
- get_weekday_initial()Retrieves the translated weekday initial.
- get_weekday_abbrev()Retrieves the translated weekday abbreviation.
- get_month()Retrieves the full translated month by month number.
- get_month_abbrev()Retrieves translated version of month abbreviation string.
- get_month_genitive()Retrieves translated version of month genitive string.
- get_meridiem()Retrieves translated version of meridiem string.
- register_globals()Global variables are deprecated.
- is_rtl()Checks if current locale is RTL.
- _strings_for_pot()Registers date/time format strings for general POT.
- get_list_item_separator()Retrieves the localized list item separator.
- get_word_count_type()Retrieves the localized word count type.
Source code
#[AllowDynamicProperties]class WP_Locale { /** * Stores the translated strings for the full weekday names. * * @since 2.1.0 * @since 6.2.0 Initialized to an empty array. * @var string[] */ public $weekday = array(); /** * Stores the translated strings for the one character weekday names. * * There is a hack to make sure that Tuesday and Thursday, as well * as Sunday and Saturday, don't conflict. See init() method for more. * * @see WP_Locale::init() for how to handle the hack. * * @since 2.1.0 * @since 6.2.0 Initialized to an empty array. * @var string[] */ public $weekday_initial = array(); /** * Stores the translated strings for the abbreviated weekday names. * * @since 2.1.0 * @since 6.2.0 Initialized to an empty array. * @var string[] */ public $weekday_abbrev = array(); /** * Stores the translated strings for the full month names. * * @since 2.1.0 * @since 6.2.0 Initialized to an empty array. * @var string[] */ public $month = array(); /** * Stores the translated strings for the month names in genitive case, if the locale specifies. * * @since 4.4.0 * @since 6.2.0 Initialized to an empty array. * @var string[] */ public $month_genitive = array(); /** * Stores the translated strings for the abbreviated month names. * * @since 2.1.0 * @since 6.2.0 Initialized to an empty array. * @var string[] */ public $month_abbrev = array(); /** * Stores the translated strings for 'am' and 'pm'. * * Also the capitalized versions. * * @since 2.1.0 * @since 6.2.0 Initialized to an empty array. * @var string[] */ public $meridiem = array(); /** * The text direction of the locale language. * * Default is left to right 'ltr'. * * @since 2.1.0 * @var string */Changelog
Introduced in 2.1.0. One change between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
6.8.8
Method
get_month_genitive() added.verified against source4.6.0
Moved to its own file from wp-includes/locale.php.from the docblock
2.1.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, from
src/wp-includes/class-wp-locale.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.