3 * Date and Time Locale object
10 * Class that loads the calendar locale.
16 * Stores the translated strings for the full weekday names.
25 * Stores the translated strings for the one character weekday names.
27 * There is a hack to make sure that Tuesday and Thursday, as well
28 * as Sunday and Saturday don't conflict. See init() method for more.
30 * @see WP_Locale::init() for how to handle the hack.
39 * Stores the translated strings for the abbreviated weekday names.
48 * Stores the translated strings for the full month names.
57 * Stores the translated strings for the abbreviated month names.
66 * Stores the translated strings for 'am' and 'pm'.
68 * Also the capalized versions.
77 * The text direction of the locale language.
79 * Default is left to right 'ltr'.
85 var $text_direction = 'ltr';
88 * Imports the global version to the class property.
94 var $locale_vars = array('text_direction');
97 * Sets up the translated strings and object properties.
99 * The method creates the translatable strings for various
100 * calendar elements. Which allows for specifying locale
101 * specific calendar names and text direction.
108 $this->weekday[0] = /* translators: weekday */ __('Sunday');
109 $this->weekday[1] = /* translators: weekday */ __('Monday');
110 $this->weekday[2] = /* translators: weekday */ __('Tuesday');
111 $this->weekday[3] = /* translators: weekday */ __('Wednesday');
112 $this->weekday[4] = /* translators: weekday */ __('Thursday');
113 $this->weekday[5] = /* translators: weekday */ __('Friday');
114 $this->weekday[6] = /* translators: weekday */ __('Saturday');
116 // The first letter of each day. The _%day%_initial suffix is a hack to make
117 // sure the day initials are unique.
118 $this->weekday_initial[__('Sunday')] = /* translators: one-letter abbreviation of the weekday */ __('S_Sunday_initial');
119 $this->weekday_initial[__('Monday')] = /* translators: one-letter abbreviation of the weekday */ __('M_Monday_initial');
120 $this->weekday_initial[__('Tuesday')] = /* translators: one-letter abbreviation of the weekday */ __('T_Tuesday_initial');
121 $this->weekday_initial[__('Wednesday')] = /* translators: one-letter abbreviation of the weekday */ __('W_Wednesday_initial');
122 $this->weekday_initial[__('Thursday')] = /* translators: one-letter abbreviation of the weekday */ __('T_Thursday_initial');
123 $this->weekday_initial[__('Friday')] = /* translators: one-letter abbreviation of the weekday */ __('F_Friday_initial');
124 $this->weekday_initial[__('Saturday')] = /* translators: one-letter abbreviation of the weekday */ __('S_Saturday_initial');
126 foreach ($this->weekday_initial as $weekday_ => $weekday_initial_) {
127 $this->weekday_initial[$weekday_] = preg_replace('/_.+_initial$/', '', $weekday_initial_);
130 // Abbreviations for each day.
131 $this->weekday_abbrev[__('Sunday')] = /* translators: three-letter abbreviation of the weekday */ __('Sun');
132 $this->weekday_abbrev[__('Monday')] = /* translators: three-letter abbreviation of the weekday */ __('Mon');
133 $this->weekday_abbrev[__('Tuesday')] = /* translators: three-letter abbreviation of the weekday */ __('Tue');
134 $this->weekday_abbrev[__('Wednesday')] = /* translators: three-letter abbreviation of the weekday */ __('Wed');
135 $this->weekday_abbrev[__('Thursday')] = /* translators: three-letter abbreviation of the weekday */ __('Thu');
136 $this->weekday_abbrev[__('Friday')] = /* translators: three-letter abbreviation of the weekday */ __('Fri');
137 $this->weekday_abbrev[__('Saturday')] = /* translators: three-letter abbreviation of the weekday */ __('Sat');
140 $this->month['01'] = /* translators: month name */ __('January');
141 $this->month['02'] = /* translators: month name */ __('February');
142 $this->month['03'] = /* translators: month name */ __('March');
143 $this->month['04'] = /* translators: month name */ __('April');
144 $this->month['05'] = /* translators: month name */ __('May');
145 $this->month['06'] = /* translators: month name */ __('June');
146 $this->month['07'] = /* translators: month name */ __('July');
147 $this->month['08'] = /* translators: month name */ __('August');
148 $this->month['09'] = /* translators: month name */ __('September');
149 $this->month['10'] = /* translators: month name */ __('October');
150 $this->month['11'] = /* translators: month name */ __('November');
151 $this->month['12'] = /* translators: month name */ __('December');
153 // Abbreviations for each month. Uses the same hack as above to get around the
154 // 'May' duplication.
155 $this->month_abbrev[__('January')] = /* translators: three-letter abbreviation of the month */ __('Jan_January_abbreviation');
156 $this->month_abbrev[__('February')] = /* translators: three-letter abbreviation of the month */ __('Feb_February_abbreviation');
157 $this->month_abbrev[__('March')] = /* translators: three-letter abbreviation of the month */ __('Mar_March_abbreviation');
158 $this->month_abbrev[__('April')] = /* translators: three-letter abbreviation of the month */ __('Apr_April_abbreviation');
159 $this->month_abbrev[__('May')] = /* translators: three-letter abbreviation of the month */ __('May_May_abbreviation');
160 $this->month_abbrev[__('June')] = /* translators: three-letter abbreviation of the month */ __('Jun_June_abbreviation');
161 $this->month_abbrev[__('July')] = /* translators: three-letter abbreviation of the month */ __('Jul_July_abbreviation');
162 $this->month_abbrev[__('August')] = /* translators: three-letter abbreviation of the month */ __('Aug_August_abbreviation');
163 $this->month_abbrev[__('September')] = /* translators: three-letter abbreviation of the month */ __('Sep_September_abbreviation');
164 $this->month_abbrev[__('October')] = /* translators: three-letter abbreviation of the month */ __('Oct_October_abbreviation');
165 $this->month_abbrev[__('November')] = /* translators: three-letter abbreviation of the month */ __('Nov_November_abbreviation');
166 $this->month_abbrev[__('December')] = /* translators: three-letter abbreviation of the month */ __('Dec_December_abbreviation');
168 foreach ($this->month_abbrev as $month_ => $month_abbrev_) {
169 $this->month_abbrev[$month_] = preg_replace('/_.+_abbreviation$/', '', $month_abbrev_);
173 $this->meridiem['am'] = __('am');
174 $this->meridiem['pm'] = __('pm');
175 $this->meridiem['AM'] = __('AM');
176 $this->meridiem['PM'] = __('PM');
178 // Numbers formatting
179 // See http://php.net/number_format
181 /* translators: $thousands_sep argument for http://php.net/number_format, default is , */
182 $trans = __('number_format_thousands_sep');
183 $this->number_format['thousands_sep'] = ('number_format_thousands_sep' == $trans) ? ',' : $trans;
185 /* translators: $dec_point argument for http://php.net/number_format, default is . */
186 $trans = __('number_format_decimal_point');
187 $this->number_format['decimal_point'] = ('number_format_decimal_point' == $trans) ? '.' : $trans;
189 // Import global locale vars set during inclusion of $locale.php.
190 foreach ( (array) $this->locale_vars as $var ) {
191 if ( isset($GLOBALS[$var]) )
192 $this->$var = $GLOBALS[$var];
198 * Retrieve the full translated weekday word.
200 * Week starts on translated Sunday and can be fetched
201 * by using 0 (zero). So the week starts with 0 (zero)
202 * and ends on Saturday with is fetched by using 6 (six).
207 * @param int $weekday_number 0 for Sunday through 6 Saturday
208 * @return string Full translated weekday
210 function get_weekday($weekday_number) {
211 return $this->weekday[$weekday_number];
215 * Retrieve the translated weekday initial.
217 * The weekday initial is retrieved by the translated
218 * full weekday word. When translating the weekday initial
219 * pay attention to make sure that the starting letter does
225 * @param string $weekday_name
228 function get_weekday_initial($weekday_name) {
229 return $this->weekday_initial[$weekday_name];
233 * Retrieve the translated weekday abbreviation.
235 * The weekday abbreviation is retrieved by the translated
241 * @param string $weekday_name Full translated weekday word
242 * @return string Translated weekday abbreviation
244 function get_weekday_abbrev($weekday_name) {
245 return $this->weekday_abbrev[$weekday_name];
249 * Retrieve the full translated month by month number.
251 * The $month_number parameter has to be a string
252 * because it must have the '0' in front of any number
253 * that is less than 10. Starts from '01' and ends at
256 * You can use an integer instead and it will add the
257 * '0' before the numbers less than 10 for you.
262 * @param string|int $month_number '01' through '12'
263 * @return string Translated full month name
265 function get_month($month_number) {
266 return $this->month[zeroise($month_number, 2)];
270 * Retrieve translated version of month abbreviation string.
272 * The $month_name parameter is expected to be the translated or
273 * translatable version of the month.
278 * @param string $month_name Translated month to get abbreviated version
279 * @return string Translated abbreviated month
281 function get_month_abbrev($month_name) {
282 return $this->month_abbrev[$month_name];
286 * Retrieve translated version of meridiem string.
288 * The $meridiem parameter is expected to not be translated.
293 * @param string $meridiem Either 'am', 'pm', 'AM', or 'PM'. Not translated version.
294 * @return string Translated version
296 function get_meridiem($meridiem) {
297 return $this->meridiem[$meridiem];
301 * Global variables are deprecated. For backwards compatibility only.
303 * @deprecated For backwards compatibility only.
308 function register_globals() {
309 $GLOBALS['weekday'] = $this->weekday;
310 $GLOBALS['weekday_initial'] = $this->weekday_initial;
311 $GLOBALS['weekday_abbrev'] = $this->weekday_abbrev;
312 $GLOBALS['month'] = $this->month;
313 $GLOBALS['month_abbrev'] = $this->month_abbrev;
317 * Constructor which calls helper methods to set up object variables
319 * @uses WP_Locale::init()
320 * @uses WP_Locale::register_globals()
325 function __construct() {
327 $this->register_globals();
330 * Checks if current locale is RTL.
333 * @return bool Whether locale is RTL.
336 return 'rtl' == $this->text_direction;
341 * Checks if current locale is RTL.
344 * @return bool Whether locale is RTL.
348 return $wp_locale->is_rtl();