author | Anthony Ly <anthonyly.com@gmail.com> |
Mon, 19 Nov 2012 18:26:13 +0100 | |
changeset 194 | 32102edaa81b |
parent 136 | bde1974c263b |
permissions | -rw-r--r-- |
136 | 1 |
<?php |
2 |
/** |
|
3 |
* Date and Time Locale object |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage i18n |
|
7 |
*/ |
|
8 |
||
9 |
/** |
|
10 |
* Class that loads the calendar locale. |
|
11 |
* |
|
12 |
* @since 2.1.0 |
|
13 |
*/ |
|
14 |
class WP_Locale { |
|
15 |
/** |
|
16 |
* Stores the translated strings for the full weekday names. |
|
17 |
* |
|
18 |
* @since 2.1.0 |
|
19 |
* @var array |
|
20 |
* @access private |
|
21 |
*/ |
|
22 |
var $weekday; |
|
23 |
||
24 |
/** |
|
25 |
* Stores the translated strings for the one character weekday names. |
|
26 |
* |
|
27 |
* There is a hack to make sure that Tuesday and Thursday, as well |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
28 |
* as Sunday and Saturday, don't conflict. See init() method for more. |
136 | 29 |
* |
30 |
* @see WP_Locale::init() for how to handle the hack. |
|
31 |
* |
|
32 |
* @since 2.1.0 |
|
33 |
* @var array |
|
34 |
* @access private |
|
35 |
*/ |
|
36 |
var $weekday_initial; |
|
37 |
||
38 |
/** |
|
39 |
* Stores the translated strings for the abbreviated weekday names. |
|
40 |
* |
|
41 |
* @since 2.1.0 |
|
42 |
* @var array |
|
43 |
* @access private |
|
44 |
*/ |
|
45 |
var $weekday_abbrev; |
|
46 |
||
47 |
/** |
|
48 |
* Stores the translated strings for the full month names. |
|
49 |
* |
|
50 |
* @since 2.1.0 |
|
51 |
* @var array |
|
52 |
* @access private |
|
53 |
*/ |
|
54 |
var $month; |
|
55 |
||
56 |
/** |
|
57 |
* Stores the translated strings for the abbreviated month names. |
|
58 |
* |
|
59 |
* @since 2.1.0 |
|
60 |
* @var array |
|
61 |
* @access private |
|
62 |
*/ |
|
63 |
var $month_abbrev; |
|
64 |
||
65 |
/** |
|
66 |
* Stores the translated strings for 'am' and 'pm'. |
|
67 |
* |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
68 |
* Also the capitalized versions. |
136 | 69 |
* |
70 |
* @since 2.1.0 |
|
71 |
* @var array |
|
72 |
* @access private |
|
73 |
*/ |
|
74 |
var $meridiem; |
|
75 |
||
76 |
/** |
|
77 |
* The text direction of the locale language. |
|
78 |
* |
|
79 |
* Default is left to right 'ltr'. |
|
80 |
* |
|
81 |
* @since 2.1.0 |
|
82 |
* @var string |
|
83 |
* @access private |
|
84 |
*/ |
|
85 |
var $text_direction = 'ltr'; |
|
86 |
||
87 |
/** |
|
88 |
* Sets up the translated strings and object properties. |
|
89 |
* |
|
90 |
* The method creates the translatable strings for various |
|
91 |
* calendar elements. Which allows for specifying locale |
|
92 |
* specific calendar names and text direction. |
|
93 |
* |
|
94 |
* @since 2.1.0 |
|
95 |
* @access private |
|
96 |
*/ |
|
97 |
function init() { |
|
98 |
// The Weekdays |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
99 |
$this->weekday[0] = /* translators: weekday */ __('Sunday'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
100 |
$this->weekday[1] = /* translators: weekday */ __('Monday'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
101 |
$this->weekday[2] = /* translators: weekday */ __('Tuesday'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
102 |
$this->weekday[3] = /* translators: weekday */ __('Wednesday'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
103 |
$this->weekday[4] = /* translators: weekday */ __('Thursday'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
104 |
$this->weekday[5] = /* translators: weekday */ __('Friday'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
105 |
$this->weekday[6] = /* translators: weekday */ __('Saturday'); |
136 | 106 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
107 |
// The first letter of each day. The _%day%_initial suffix is a hack to make |
136 | 108 |
// sure the day initials are unique. |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
109 |
$this->weekday_initial[__('Sunday')] = /* translators: one-letter abbreviation of the weekday */ __('S_Sunday_initial'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
110 |
$this->weekday_initial[__('Monday')] = /* translators: one-letter abbreviation of the weekday */ __('M_Monday_initial'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
111 |
$this->weekday_initial[__('Tuesday')] = /* translators: one-letter abbreviation of the weekday */ __('T_Tuesday_initial'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
112 |
$this->weekday_initial[__('Wednesday')] = /* translators: one-letter abbreviation of the weekday */ __('W_Wednesday_initial'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
113 |
$this->weekday_initial[__('Thursday')] = /* translators: one-letter abbreviation of the weekday */ __('T_Thursday_initial'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
114 |
$this->weekday_initial[__('Friday')] = /* translators: one-letter abbreviation of the weekday */ __('F_Friday_initial'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
115 |
$this->weekday_initial[__('Saturday')] = /* translators: one-letter abbreviation of the weekday */ __('S_Saturday_initial'); |
136 | 116 |
|
117 |
foreach ($this->weekday_initial as $weekday_ => $weekday_initial_) { |
|
118 |
$this->weekday_initial[$weekday_] = preg_replace('/_.+_initial$/', '', $weekday_initial_); |
|
119 |
} |
|
120 |
||
121 |
// Abbreviations for each day. |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
122 |
$this->weekday_abbrev[__('Sunday')] = /* translators: three-letter abbreviation of the weekday */ __('Sun'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
123 |
$this->weekday_abbrev[__('Monday')] = /* translators: three-letter abbreviation of the weekday */ __('Mon'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
124 |
$this->weekday_abbrev[__('Tuesday')] = /* translators: three-letter abbreviation of the weekday */ __('Tue'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
125 |
$this->weekday_abbrev[__('Wednesday')] = /* translators: three-letter abbreviation of the weekday */ __('Wed'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
126 |
$this->weekday_abbrev[__('Thursday')] = /* translators: three-letter abbreviation of the weekday */ __('Thu'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
127 |
$this->weekday_abbrev[__('Friday')] = /* translators: three-letter abbreviation of the weekday */ __('Fri'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
128 |
$this->weekday_abbrev[__('Saturday')] = /* translators: three-letter abbreviation of the weekday */ __('Sat'); |
136 | 129 |
|
130 |
// The Months |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
131 |
$this->month['01'] = /* translators: month name */ __('January'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
132 |
$this->month['02'] = /* translators: month name */ __('February'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
133 |
$this->month['03'] = /* translators: month name */ __('March'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
134 |
$this->month['04'] = /* translators: month name */ __('April'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
135 |
$this->month['05'] = /* translators: month name */ __('May'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
136 |
$this->month['06'] = /* translators: month name */ __('June'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
137 |
$this->month['07'] = /* translators: month name */ __('July'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
138 |
$this->month['08'] = /* translators: month name */ __('August'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
139 |
$this->month['09'] = /* translators: month name */ __('September'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
140 |
$this->month['10'] = /* translators: month name */ __('October'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
141 |
$this->month['11'] = /* translators: month name */ __('November'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
142 |
$this->month['12'] = /* translators: month name */ __('December'); |
136 | 143 |
|
144 |
// Abbreviations for each month. Uses the same hack as above to get around the |
|
145 |
// 'May' duplication. |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
146 |
$this->month_abbrev[__('January')] = /* translators: three-letter abbreviation of the month */ __('Jan_January_abbreviation'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
147 |
$this->month_abbrev[__('February')] = /* translators: three-letter abbreviation of the month */ __('Feb_February_abbreviation'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
148 |
$this->month_abbrev[__('March')] = /* translators: three-letter abbreviation of the month */ __('Mar_March_abbreviation'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
149 |
$this->month_abbrev[__('April')] = /* translators: three-letter abbreviation of the month */ __('Apr_April_abbreviation'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
150 |
$this->month_abbrev[__('May')] = /* translators: three-letter abbreviation of the month */ __('May_May_abbreviation'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
151 |
$this->month_abbrev[__('June')] = /* translators: three-letter abbreviation of the month */ __('Jun_June_abbreviation'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
152 |
$this->month_abbrev[__('July')] = /* translators: three-letter abbreviation of the month */ __('Jul_July_abbreviation'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
153 |
$this->month_abbrev[__('August')] = /* translators: three-letter abbreviation of the month */ __('Aug_August_abbreviation'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
154 |
$this->month_abbrev[__('September')] = /* translators: three-letter abbreviation of the month */ __('Sep_September_abbreviation'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
155 |
$this->month_abbrev[__('October')] = /* translators: three-letter abbreviation of the month */ __('Oct_October_abbreviation'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
156 |
$this->month_abbrev[__('November')] = /* translators: three-letter abbreviation of the month */ __('Nov_November_abbreviation'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
157 |
$this->month_abbrev[__('December')] = /* translators: three-letter abbreviation of the month */ __('Dec_December_abbreviation'); |
136 | 158 |
|
159 |
foreach ($this->month_abbrev as $month_ => $month_abbrev_) { |
|
160 |
$this->month_abbrev[$month_] = preg_replace('/_.+_abbreviation$/', '', $month_abbrev_); |
|
161 |
} |
|
162 |
||
163 |
// The Meridiems |
|
164 |
$this->meridiem['am'] = __('am'); |
|
165 |
$this->meridiem['pm'] = __('pm'); |
|
166 |
$this->meridiem['AM'] = __('AM'); |
|
167 |
$this->meridiem['PM'] = __('PM'); |
|
168 |
||
169 |
// Numbers formatting |
|
170 |
// See http://php.net/number_format |
|
171 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
172 |
/* translators: $thousands_sep argument for http://php.net/number_format, default is , */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
173 |
$trans = __('number_format_thousands_sep'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
174 |
$this->number_format['thousands_sep'] = ('number_format_thousands_sep' == $trans) ? ',' : $trans; |
136 | 175 |
|
176 |
/* translators: $dec_point argument for http://php.net/number_format, default is . */ |
|
177 |
$trans = __('number_format_decimal_point'); |
|
178 |
$this->number_format['decimal_point'] = ('number_format_decimal_point' == $trans) ? '.' : $trans; |
|
179 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
180 |
// Set text direction. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
181 |
if ( isset( $GLOBALS['text_direction'] ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
182 |
$this->text_direction = $GLOBALS['text_direction']; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
183 |
/* translators: 'rtl' or 'ltr'. This sets the text direction for WordPress. */ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
184 |
elseif ( 'rtl' == _x( 'ltr', 'text direction' ) ) |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
185 |
$this->text_direction = 'rtl'; |
136 | 186 |
} |
187 |
||
188 |
/** |
|
189 |
* Retrieve the full translated weekday word. |
|
190 |
* |
|
191 |
* Week starts on translated Sunday and can be fetched |
|
192 |
* by using 0 (zero). So the week starts with 0 (zero) |
|
193 |
* and ends on Saturday with is fetched by using 6 (six). |
|
194 |
* |
|
195 |
* @since 2.1.0 |
|
196 |
* @access public |
|
197 |
* |
|
198 |
* @param int $weekday_number 0 for Sunday through 6 Saturday |
|
199 |
* @return string Full translated weekday |
|
200 |
*/ |
|
201 |
function get_weekday($weekday_number) { |
|
202 |
return $this->weekday[$weekday_number]; |
|
203 |
} |
|
204 |
||
205 |
/** |
|
206 |
* Retrieve the translated weekday initial. |
|
207 |
* |
|
208 |
* The weekday initial is retrieved by the translated |
|
209 |
* full weekday word. When translating the weekday initial |
|
210 |
* pay attention to make sure that the starting letter does |
|
211 |
* not conflict. |
|
212 |
* |
|
213 |
* @since 2.1.0 |
|
214 |
* @access public |
|
215 |
* |
|
216 |
* @param string $weekday_name |
|
217 |
* @return string |
|
218 |
*/ |
|
219 |
function get_weekday_initial($weekday_name) { |
|
220 |
return $this->weekday_initial[$weekday_name]; |
|
221 |
} |
|
222 |
||
223 |
/** |
|
224 |
* Retrieve the translated weekday abbreviation. |
|
225 |
* |
|
226 |
* The weekday abbreviation is retrieved by the translated |
|
227 |
* full weekday word. |
|
228 |
* |
|
229 |
* @since 2.1.0 |
|
230 |
* @access public |
|
231 |
* |
|
232 |
* @param string $weekday_name Full translated weekday word |
|
233 |
* @return string Translated weekday abbreviation |
|
234 |
*/ |
|
235 |
function get_weekday_abbrev($weekday_name) { |
|
236 |
return $this->weekday_abbrev[$weekday_name]; |
|
237 |
} |
|
238 |
||
239 |
/** |
|
240 |
* Retrieve the full translated month by month number. |
|
241 |
* |
|
242 |
* The $month_number parameter has to be a string |
|
243 |
* because it must have the '0' in front of any number |
|
244 |
* that is less than 10. Starts from '01' and ends at |
|
245 |
* '12'. |
|
246 |
* |
|
247 |
* You can use an integer instead and it will add the |
|
248 |
* '0' before the numbers less than 10 for you. |
|
249 |
* |
|
250 |
* @since 2.1.0 |
|
251 |
* @access public |
|
252 |
* |
|
253 |
* @param string|int $month_number '01' through '12' |
|
254 |
* @return string Translated full month name |
|
255 |
*/ |
|
256 |
function get_month($month_number) { |
|
257 |
return $this->month[zeroise($month_number, 2)]; |
|
258 |
} |
|
259 |
||
260 |
/** |
|
261 |
* Retrieve translated version of month abbreviation string. |
|
262 |
* |
|
263 |
* The $month_name parameter is expected to be the translated or |
|
264 |
* translatable version of the month. |
|
265 |
* |
|
266 |
* @since 2.1.0 |
|
267 |
* @access public |
|
268 |
* |
|
269 |
* @param string $month_name Translated month to get abbreviated version |
|
270 |
* @return string Translated abbreviated month |
|
271 |
*/ |
|
272 |
function get_month_abbrev($month_name) { |
|
273 |
return $this->month_abbrev[$month_name]; |
|
274 |
} |
|
275 |
||
276 |
/** |
|
277 |
* Retrieve translated version of meridiem string. |
|
278 |
* |
|
279 |
* The $meridiem parameter is expected to not be translated. |
|
280 |
* |
|
281 |
* @since 2.1.0 |
|
282 |
* @access public |
|
283 |
* |
|
284 |
* @param string $meridiem Either 'am', 'pm', 'AM', or 'PM'. Not translated version. |
|
285 |
* @return string Translated version |
|
286 |
*/ |
|
287 |
function get_meridiem($meridiem) { |
|
288 |
return $this->meridiem[$meridiem]; |
|
289 |
} |
|
290 |
||
291 |
/** |
|
292 |
* Global variables are deprecated. For backwards compatibility only. |
|
293 |
* |
|
294 |
* @deprecated For backwards compatibility only. |
|
295 |
* @access private |
|
296 |
* |
|
297 |
* @since 2.1.0 |
|
298 |
*/ |
|
299 |
function register_globals() { |
|
300 |
$GLOBALS['weekday'] = $this->weekday; |
|
301 |
$GLOBALS['weekday_initial'] = $this->weekday_initial; |
|
302 |
$GLOBALS['weekday_abbrev'] = $this->weekday_abbrev; |
|
303 |
$GLOBALS['month'] = $this->month; |
|
304 |
$GLOBALS['month_abbrev'] = $this->month_abbrev; |
|
305 |
} |
|
306 |
||
307 |
/** |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
308 |
* Constructor which calls helper methods to set up object variables |
136 | 309 |
* |
310 |
* @uses WP_Locale::init() |
|
311 |
* @uses WP_Locale::register_globals() |
|
312 |
* @since 2.1.0 |
|
313 |
* |
|
314 |
* @return WP_Locale |
|
315 |
*/ |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
316 |
function __construct() { |
136 | 317 |
$this->init(); |
318 |
$this->register_globals(); |
|
319 |
} |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
320 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
321 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
322 |
* Checks if current locale is RTL. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
323 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
324 |
* @since 3.0.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
325 |
* @return bool Whether locale is RTL. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
326 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
327 |
function is_rtl() { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
328 |
return 'rtl' == $this->text_direction; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
329 |
} |
136 | 330 |
} |
331 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
332 |
/** |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
333 |
* Checks if current locale is RTL. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
334 |
* |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
335 |
* @since 3.0.0 |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
336 |
* @return bool Whether locale is RTL. |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
337 |
*/ |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
338 |
function is_rtl() { |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
339 |
global $wp_locale; |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
340 |
return $wp_locale->is_rtl(); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
341 |
} |