Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezlocale.php
Go to the documentation of this file.
1 <?php
110 class eZLocale
111 {
112 public $Language;
113 const DEBUG_INTERNALS = false;
114
121 public function __construct( $localeString )
122 {
123 $this->IsValid = false;
124 $this->TimePHPArray = array( 'g', 'G', 'h', 'H', 'i', 's', 'U', 'I', 'L', 't' );
125 $this->DatePHPArray = array( 'd', 'j', 'm', 'n', 'O', 'S', 'T', 'U', 'w', 'W', 'Y', 'y', 'z', 'Z', 'I', 'L', 't' );
126 $this->DateTimePHPArray = array( 'd', 'j', 'm', 'n', 'O', 'T', 'U', 'w', 'W', 'Y', 'y', 'z', 'Z',
127 'g', 'G', 'h', 'H', 'i', 's', 'S', 'U', 'I', 'L', 't', 'a', 'c', 'r' );
128 $this->TimeArray = preg_replace( '/.+/', '%$0', $this->TimePHPArray );
129 $this->DateArray = preg_replace( '/.+/', '%$0', $this->DatePHPArray );
130 $this->DateTimeArray = preg_replace( '/.+/', '%$0', $this->DateTimePHPArray );
131
132 $this->TimeSlashInputArray = preg_replace( '/.+/', '/(?<!%)$0/', $this->TimePHPArray );
133 $this->DateSlashInputArray = preg_replace( '/.+/', '/(?<!%)$0/', $this->DatePHPArray );
134 $this->DateTimeSlashInputArray = preg_replace( '/.+/', '/(?<!%)$0/', $this->DateTimePHPArray );
135
136 $this->TimeSlashOutputArray = preg_replace( '/.+/', '\\\\$0', $this->TimePHPArray );
137 $this->DateSlashOutputArray = preg_replace( '/.+/', '\\\\$0', $this->DatePHPArray );
138 $this->DateTimeSlashOutputArray = preg_replace( '/.+/', '\\\\$0', $this->DateTimePHPArray );
139
140 $this->HTTPLocaleCode = '';
141 $this->functionMap = array(
142 'time' => 'formatTime',
143 'shorttime' => 'formatShortTime',
144 'date' => 'formatDate',
145 'shortdate' => 'formatShortDate',
146 'datetime' => 'formatDateTime',
147 'shortdatetime' => 'formatShortDateTime',
148 'currency' => 'formatCurrencyWithSymbol',
149 'clean_currency' => 'formatCleanCurrency',
150 'number' => 'formatNumber',
151 );
152
153 $this->DayNames = array( 0 => 'sun', 1 => 'mon', 2 => 'tue',
154 3 => 'wed', 4 => 'thu', 5 => 'fri', 6 => 'sat' );
155 $this->MonthNames = array( 1 => 'jan', 2 => 'feb', 3 => 'mar',
156 4 => 'apr', 5 => 'may', 6 => 'jun',
157 7 => 'jul', 8 => 'aug', 9 => 'sep',
158 10 => 'oct', 11 => 'nov', 12 => 'dec' );
159 $this->WeekDays = array( 0, 1, 2, 3, 4, 5, 6 );
160 $this->Months = array( 1, 2, 3, 4, 5, 6,
161 7, 8, 9, 10, 11, 12 );
162
163 $locale = eZLocale::localeInformation( $localeString );
164
165 $this->CountryCode = $locale['country'];
166 $this->CountryVariation = $locale['country-variation'];
167 $this->LanguageCode = $locale['language'];
168 $this->LocaleCode = $locale['locale'];
169 $this->TranslationCode = $locale['locale'];
170 $this->Charset = $locale['charset'];
171 $this->OverrideCharset = $locale['charset'];
172
173 $this->LocaleINI = array( 'default' => null, 'variation' => null );
174 $this->CountryINI = array( 'default' => null, 'variation' => null );
175 $this->LanguageINI = array( 'default' => null, 'variation' => null );
176
177 // Figure out if we use one locale file or separate country/language file.
178 $localeINI = $this->localeFile();
179 $countryINI = $localeINI;
180 $languageINI = $localeINI;
181 if ( $localeINI === null )
182 {
183 $countryINI = $this->countryFile();
184 $languageINI = $this->languageFile();
185 }
186
187 $this->reset();
188
189 $this->IsValid = true;
190
191 // Load country information
192 if ( $countryINI !== null )
193 {
194 $this->initCountry( $countryINI );
195 }
196 else
197 {
198 $this->IsValid = false;
199 eZDebug::writeError( 'Could not load country settings for ' . $this->CountryCode, 'eZLocale' );
200 }
201
202 // Load language information
203 if ( $languageINI !== null )
204 {
205 $this->initLanguage( $languageINI );
206 }
207 else
208 {
209 $this->IsValid = false;
210 eZDebug::writeError( 'Could not load language settings for ' . $this->LanguageCode, 'eZLocale' );
211 }
212
213
214 // Load variation if any
215 if ( $this->countryVariation() )
216 {
217 $localeVariationINI = $this->localeFile( true );
218 $countryVariationINI = $localeVariationINI;
219 $languageVariationINI = $localeVariationINI;
220 if ( $localeVariationINI === null )
221 {
222 $countryVariationINI = $this->countryFile( true );
223 $languageVariationINI = $this->languageFile( true );
224 }
225
226 // Load country information
227 if ( $countryVariationINI !== null )
228 {
229 $this->initCountry( $countryVariationINI );
230 }
231
232 // Load language information
233 if ( $languageVariationINI !== null )
234 {
235 $this->initLanguage( $languageVariationINI );
236 }
237 }
238
239 if ( $this->MondayFirst )
240 {
241 $this->WeekDays[] = array_shift( $this->WeekDays );
242 }
243
244 $this->AM = 'am';
245 $this->PM = 'pm';
246 }
247
251 function reset()
252 {
253 $this->TimeFormat = '';
254 $this->ShortTimeFormat = '';
255 $this->DateFormat = '';
256 $this->ShortDateFormat = '';
257 $this->DateTimeFormat = '';
258 $this->ShortDateTimeFormat = '';
259
260 $this->MondayFirst = false;
261
262 $this->Country = '';
263 $this->CountryComment = '';
264
265 $this->DecimalSymbol = '';
266 $this->ThousandsSeparator = '';
267 $this->FractDigits = 2;
268 $this->NegativeSymbol = '-';
269 $this->PositiveSymbol = '';
270
271 $this->CurrencyDecimalSymbol = '';
272 $this->CurrencyName = '';
273 $this->CurrencyShortName = '';
274 $this->CurrencyThousandsSeparator = '';
275 $this->CurrencyFractDigits = 2;
276 $this->CurrencyNegativeSymbol = '-';
277 $this->CurrencyPositiveSymbol = '';
278 $this->CurrencySymbol = '';
279 $this->CurrencyPositiveFormat = '';
280 $this->CurrencyNegativeFormat = '';
281 $this->CountryNames = '';
282
283 $this->LanguageName = '';
284 $this->LanguageComment = '';
285 $this->IntlLanguageName = '';
286 $this->AllowedCharsets = array();
287
288 $this->ShortDayNames = array();
289 $this->LongDayNames = array();
290 foreach ( $this->DayNames as $day )
291 {
292 $this->ShortDayNames[$day] = '';
293 $this->LongDayNames[$day] = '';
294 }
295
296 $this->ShortMonthNames = array();
297 $this->LongMonthNames = array();
298 foreach ( $this->MonthNames as $month )
299 {
300 $this->ShortMonthNames[$month] = '';
301 $this->LongMonthNames[$month] = '';
302 }
303
304 $this->ShortWeekDayNames = array();
305 $this->LongWeekDayNames = array();
306 foreach( $this->WeekDays as $wday )
307 {
308 $code = $this->DayNames[$wday];
309 $this->ShortWeekDayNames[$wday] = '';
310 $this->LongWeekDayNames[$wday] = '';
311 }
312 }
313
317 function isValid()
318 {
319 return $this->IsValid;
320 }
321
325 function initCountry( &$countryINI )
326 {
327 $countryINI->assign( 'DateTime', 'TimeFormat', $this->TimeFormat );
328 $countryINI->assign( 'DateTime', 'ShortTimeFormat', $this->ShortTimeFormat );
329 $countryINI->assign( 'DateTime', 'DateFormat', $this->DateFormat );
330 $countryINI->assign( 'DateTime', 'ShortDateFormat', $this->ShortDateFormat );
331 $countryINI->assign( 'DateTime', 'DateTimeFormat', $this->DateTimeFormat );
332 $countryINI->assign( 'DateTime', 'ShortDateTimeFormat', $this->ShortDateTimeFormat );
333
334 if ( $countryINI->hasVariable( 'DateTime', 'MondayFirst' ) )
335 $this->MondayFirst = strtolower( $countryINI->variable( 'DateTime', 'MondayFirst' ) ) == 'yes';
336
337 $countryINI->assign( 'RegionalSettings', 'Country', $this->Country );
338 $countryINI->assign( "RegionalSettings", "CountryComment", $this->CountryComment );
339
340 $countryINI->assign( 'Numbers', 'DecimalSymbol', $this->DecimalSymbol );
341 $countryINI->assign( 'Numbers', 'ThousandsSeparator', $this->ThousandsSeparator );
342 $countryINI->assign( 'Numbers', 'FractDigits', $this->FractDigits );
343 $countryINI->assign( 'Numbers', 'NegativeSymbol', $this->NegativeSymbol );
344 $countryINI->assign( 'Numbers', 'PositiveSymbol', $this->PositiveSymbol );
345
346 $countryINI->assign( 'Currency', 'DecimalSymbol', $this->CurrencyDecimalSymbol );
347 $countryINI->assign( 'Currency', 'Name', $this->CurrencyName );
348 $countryINI->assign( 'Currency', 'ShortName', $this->CurrencyShortName );
349 $countryINI->assign( 'Currency', 'ThousandsSeparator', $this->CurrencyThousandsSeparator );
350 $countryINI->assign( 'Currency', 'FractDigits', $this->CurrencyFractDigits );
351 $countryINI->assign( 'Currency', 'NegativeSymbol', $this->CurrencyNegativeSymbol );
352 $countryINI->assign( 'Currency', 'PositiveSymbol', $this->CurrencyPositiveSymbol );
353 $countryINI->assign( 'Currency', 'Symbol', $this->CurrencySymbol );
354 $countryINI->assign( 'Currency', 'PositiveFormat', $this->CurrencyPositiveFormat );
355 $countryINI->assign( 'Currency', 'NegativeFormat', $this->CurrencyNegativeFormat );
356 if ( $countryINI->hasVariable( 'CountryNames', 'Countries' ) )
357 $this->CountryNames = $countryINI->variable( 'CountryNames', 'Countries' );
358
359 }
360
364 function initLanguage( &$languageINI )
365 {
366 $languageINI->assign( "RegionalSettings", "LanguageName", $this->LanguageName );
367 $languageINI->assign( "RegionalSettings", "InternationalLanguageName", $this->IntlLanguageName );
368 $languageINI->assign( "RegionalSettings", "LanguageComment", $this->LanguageComment );
369 $languageINI->assign( 'RegionalSettings', 'TranslationCode', $this->TranslationCode );
370
371 if ( $this->OverrideCharset == '' )
372 {
373 $charset = false;
374 if ( $languageINI->hasVariable( 'Charset', 'Preferred' ) )
375 {
376 $charset = $languageINI->variable( 'Charset', 'Preferred' );
377 if ( $charset != '' )
378 $this->Charset = $charset;
379 }
380 }
381 if ( $languageINI->hasVariable( 'Charset', 'Allowed' ) )
382 {
383 $this->AllowedCharsets = $languageINI->variable( 'Charset', 'Allowed' );
384 }
385 else
386 {
387 if ( $languageINI->hasVariable( 'Charset', 'Preferred' ) )
388 $this->AllowedCharsets[] = $languageINI->variable( 'Charset', 'Preferred' );
389 }
390
391
392 if ( !is_array( $this->ShortDayNames ) )
393 $this->ShortDayNames = array();
394 if ( !is_array( $this->LongDayNames ) )
395 $this->LongDayNames = array();
396
397 $tmpShortDayNames = array();
398 if ( $languageINI->hasGroup( 'ShortDayNames' ) )
399 $tmpShortDayNames = $languageINI->variableMulti( 'ShortDayNames', $this->DayNames );
400 $tmpLongDayNames = array();
401 if ( $languageINI->hasGroup( 'LongDayNames' ) )
402 $tmpLongDayNames = $languageINI->variableMulti( 'LongDayNames', $this->DayNames );
403 foreach ( $this->DayNames as $key => $day )
404 {
405 if ( isset( $tmpShortDayNames[$key] ) )
406 $this->ShortDayNames[$day] = $tmpShortDayNames[$key];
407 if ( isset( $tmpLongDayNames[$key] ) )
408 $this->LongDayNames[$day] = $tmpLongDayNames[$key];
409 }
410
411
412 if ( !is_array( $this->ShortMonthNames ) )
413 $this->LongMonthNames = array();
414 if ( !is_array( $this->ShortMonthNames ) )
415 $this->LongMonthNames = array();
416
417 $tmpShortMonthNames = array();
418 if ( $languageINI->hasGroup( 'ShortMonthNames' ) )
419 $tmpShortMonthNames = $languageINI->variableMulti( 'ShortMonthNames', $this->MonthNames );
420 $tmpLongMonthNames = array();
421 if ( $languageINI->hasGroup( 'LongMonthNames' ) )
422 $tmpLongMonthNames = $languageINI->variableMulti( 'LongMonthNames', $this->MonthNames );
423 foreach ( $this->MonthNames as $key => $day )
424 {
425 if ( isset( $tmpShortMonthNames[$key] ) )
426 $this->ShortMonthNames[$day] = $tmpShortMonthNames[$key];
427 if ( isset( $tmpLongMonthNames[$key] ) )
428 $this->LongMonthNames[$day] = $tmpLongMonthNames[$key];
429 }
430
431
432 if ( !is_array( $this->ShortWeekDayNames ) )
433 $this->ShortWeekDayNames = array();
434 if ( !is_array( $this->LongWeekDayNames ) )
435 $this->LongWeekDayNames = array();
436
437 foreach ( $this->WeekDays as $key => $day )
438 {
439 if ( isset( $tmpShortDayNames[$key] ) )
440 $this->ShortWeekDayNames[$day] = $tmpShortDayNames[$key];
441 if ( isset( $tmpLongDayNames[$key] ) )
442 $this->LongWeekDayNames[$day] = $tmpLongDayNames[$key];
443 }
444
445 if ( $languageINI->hasVariable( 'HTTP', 'ContentLanguage' ) )
446 $this->HTTPLocaleCode = $languageINI->variable( 'HTTP', 'ContentLanguage' );
447 }
448
463 static function localeRegexp( $withVariations = true, $withCharset = true )
464 {
465 return "([a-zA-Z]+)([_-]([a-zA-Z]+))?" . ( $withCharset ? "(\.([a-zA-Z-]+))?" : '' ) . ( $withVariations ? "(@([a-zA-Z0-9]+))?" : '' );
466 }
467
474 function localeInformation( $localeString )
475 {
476 $info = null;
477 if ( preg_match( '/^([a-zA-Z]+)([_-]([a-zA-Z]+))?(\.([a-zA-Z-]+))?(@([a-zA-Z0-9]+))?/', $localeString, $regs ) )
478 {
479 $info = array();
480 $language = strtolower( $regs[1] );
481 $country = '';
482 if ( isset( $regs[3] ) )
483 $country = strtoupper( $regs[3] );
484 $charset = '';
485 if ( isset( $regs[5] ) )
486 $charset = strtolower( $regs[5] );
487 $countryVariation = '';
488 if ( isset( $regs[7] ) )
489 $countryVariation = strtolower( $regs[7] );
490 $locale = $language;
491 if ( $country !== '' )
492 $locale .= '-' . $country;
493 $info['language'] = $language;
494 $info['country'] = $country;
495 $info['country-variation'] = $countryVariation;
496 $info['charset'] = $charset;
497 $info['locale'] = $locale;
498 }
499 else
500 {
501 $info = array();
502 $locale = strtolower( $localeString );
503 $language = $locale;
504 $info['language'] = $language;
505 $info['country'] = '';
506 $info['country-variation'] = '';
507 $info['charset'] = '';
508 $info['locale'] = $locale;
509 }
510 return $info;
511 }
512
518 function initPHP( $charset = false )
519 {
520 if ( $charset === false )
521 $charset = $this->Language->code();
522 setlocale( LC_ALL, $charset );
523 }
524
525 function attributes()
526 {
527 return array_keys( eZLocale::attributeFunctionMap() );
528 }
529
530 function hasAttribute( $attribute )
531 {
532 $attributeMap = eZLocale::attributeFunctionMap();
533 if ( isset( $attributeMap[$attribute] ) )
534 return true;
535 else
536 return false;
537 }
538
539 function attribute( $attribute )
540 {
541 $attributeMap = eZLocale::attributeFunctionMap();
542 if ( isset( $attributeMap[$attribute] ) )
543 {
544 $method = $attributeMap[$attribute];
545 if ( method_exists( $this, $method ) )
546 {
547 return $this->$method();
548 }
549 else
550 {
551 eZDebug::writeError( "Unknown method '$method' specified for attribute '$attribute'", __METHOD__ );
552 return null;
553 }
554 }
555
556 eZDebug::writeError( "Attribute '$attribute' does not exist", __METHOD__ );
557 return null;
558 }
559
560 function attributeFunctionMap()
561 {
562 return array( 'charset' => 'charset',
563 'allowed_charsets' => 'allowedCharsets',
564 'country_name' => 'countryName',
565 'country_comment' => 'countryComment',
566 'country_code' => 'countryCode',
567 'country_variation' => 'countryVariation',
568 'language_name' => 'languageName',
569 'intl_language_name' => 'internationalLanguageName',
570 'language_code' => 'languageCode',
571 'language_comment' => 'languageComment',
572 'locale_code' => 'localeCode',
573 'locale_full_code' => 'localeFullCode',
574 'http_locale_code' => 'httpLocaleCode',
575 'decimal_symbol' => 'decimalSymbol',
576 'thousands_separator' => 'thousandsSeparator',
577 'decimal_count' => 'decimalCount',
578 'negative_symbol' => 'negativeSymbol',
579 'positive_symbol' => 'positiveSymbol',
580 'currency_decimal_symbol' => 'currencyDecimalSymbol',
581 'currency_thousands_separator' => 'currencyThousandsSeparator',
582 'currency_decimal_count' => 'currencyDecimalCount',
583 'currency_negative_symbol' => 'currencyNegativeSymbol',
584 'currency_positive_symbol' => 'currencyPositiveSymbol',
585 'currency_symbol' => 'currencySymbol',
586 'currency_name' => 'currencyName',
587 'currency_short_name' => 'currencyShortName',
588 'is_monday_first' => 'isMondayFirst',
589 'weekday_name_list' => 'weekDayNames',
590 'weekday_short_name_list' => 'weekDayShortNames',
591 'weekday_number_list' => 'weekDays',
592 'month_list' => 'months',
593 'month_name_list' => 'monthsNames',
594 'is_valid' => 'isValid' );
595 }
596
601 function charset()
602 {
603 return $this->Charset;
604 }
605
609 function allowedCharsets()
610 {
611 return $this->AllowedCharsets;
612 }
613
617 function countryName()
618 {
619 return $this->Country;
620 }
621
625 function countryComment()
626 {
627 return $this->CountryComment;
628 }
629
633 function countryCode()
634 {
635 return $this->CountryCode;
636 }
637
641 function countryVariation()
642 {
643 return $this->CountryVariation;
644 }
645
649 function languageCode()
650 {
651 return $this->LanguageCode;
652 }
653
657 function languageComment()
658 {
659 return $this->LanguageComment;
660 }
661
666 function localeCode()
667 {
668 return $this->LocaleCode;
669 }
670
674 function localeFullCode()
675 {
676 $locale = $this->LocaleCode;
677 $variation = $this->countryVariation();
678 if ( $variation )
679 $locale .= "@" . $variation;
680 return $locale;
681 }
682
689 function httpLocaleCode()
690 {
691 $ini = eZINI::instance();
692 $localeCode = '';
693 if ( $ini->hasVariable( 'RegionalSettings', 'HTTPLocale' ) )
694 {
695 $localeCode = $ini->variable( 'RegionalSettings', 'HTTPLocale' );
696 }
697 if ( $localeCode == '' and
698 $this->HTTPLocaleCode != '' )
699 $localeCode = $this->HTTPLocaleCode;
700 if ( $localeCode == '' )
701 $localeCode = $this->localeCode();
702 return $localeCode;
703 }
704
711 static function currentLocaleCode()
712 {
713 $locale = eZLocale::instance();
714 return $locale->localeCode();
715 }
716
720 function languageName()
721 {
722 return $this->LanguageName;
723 }
724
728 function internationalLanguageName()
729 {
730 return $this->IntlLanguageName;
731 }
732
736 function currencySymbol()
737 {
738 return $this->CurrencySymbol;
739 }
740
744 function currencyName()
745 {
746 return $this->CurrencyName;
747 }
748
752 function currencyShortName()
753 {
754 return $this->CurrencyShortName;
755 }
756
761 function isMondayFirst()
762 {
763 return $this->MondayFirst;
764 }
765
769 function decimalSymbol()
770 {
771 return $this->DecimalSymbol;
772 }
773
777 function thousandsSeparator()
778 {
779 return $this->ThousandsSeparator;
780 }
781
785 function decimalCount()
786 {
787 return $this->FractDigits;
788 }
789
793 function negativeSymbol()
794 {
795 return $this->NegativeSymbol;
796 }
797
801 function positiveSymbol()
802 {
803 return $this->PositiveSymbol;
804 }
805
809 function currencyDecimalSymbol()
810 {
811 return $this->CurrencyDecimalSymbol;
812 }
813
817 function currencyThousandsSeparator()
818 {
819 return $this->CurrencyThousandsSeparator;
820 }
821
825 function currencyDecimalCount()
826 {
827 return $this->CurrencyFractDigits;
828 }
829
833 function currencyNegativeSymbol()
834 {
835 return $this->CurrencyNegativeSymbol;
836 }
837
841 function currencyPositiveSymbol()
842 {
843 return $this->CurrencyPositiveSymbol;
844 }
845
851 function weekDays()
852 {
853 return $this->WeekDays;
854 }
855
860 function months()
861 {
862 return $this->Months;
863 }
864
869 function monthsNames()
870 {
871 return $this->LongMonthNames;
872 }
873
877 function weekDayNames( $short = false )
878 {
879 if ( $short )
880 $dayList = $this->ShortWeekDayNames;
881 else
882 $dayList = $this->LongWeekDayNames;
883
884 $resultDayList = array();
885 foreach ( $this->WeekDays as $day )
886 {
887 $resultDayList[ $day ] = $dayList[ $day ];
888 }
889 return $resultDayList;
890 }
891
895 function weekDayShortNames()
896 {
897 return $this->weekDayNames( true );
898 }
899
903 function getFormattingFunction( $qualifier )
904 {
905 if ( isset( $this->functionMap[$qualifier] ) )
906 {
907 return $this->functionMap[$qualifier];
908 }
909 else
910 {
911 return false;
912 }
913 }
914
918 static function fetchByHttpLocaleCode( $httpLocaleCode )
919 {
920 $locales = self::localeList( true );
921 foreach ( $locales as $locale )
922 {
923 if ( $locale->httpLocaleCode() == $httpLocaleCode )
924 return $locale;
925 }
926
927 return false;
928 }
929
934 function formatTime( $time = false )
935 {
936 return $this->formatTimeType( $this->TimeFormat, $time );
937 }
938
943 function formatShortTime( $time = false )
944 {
945 return $this->formatTimeType( $this->ShortTimeFormat, $time );
946 }
947
953 function formatTimeType( $fmt, $time = false )
954 {
955 if ( $time == false )
956 $time = time();
957
958 $text = date( eZLocale::transformToPHPFormat( $fmt, $this->TimePHPArray ), $time );
959 return str_replace( array( '%a', '%A' ),
960 array( $this->meridiemName( $time, false ),
961 $this->meridiemName( $time, true ) ),
962 $text );
963 }
964
973 function meridiemName( $time = false, $upcase = false )
974 {
975 if ( $time == false )
976 $time = time();
977 $hour = date( 'G', $time );
978 $name = $hour < 12 ? $this->AM : $this->PM;
979 if ( $upcase )
980 $name = strtoupper( $name );
981 return $name;
982 }
983
988 function formatDate( $date = false )
989 {
990 return $this->formatDateType( $this->DateFormat, $date );
991 }
992
997 function formatShortDate( $date = false )
998 {
999 return $this->formatDateType( $this->ShortDateFormat, $date );
1000 }
1001
1006 function formatDateTime( $date = false )
1007 {
1008 return $this->formatDateTimeType( $this->DateTimeFormat, $date );
1009 }
1010
1015 function formatShortDateTime( $date = false )
1016 {
1017 return $this->formatDateTimeType( $this->ShortDateTimeFormat, $date );
1018 }
1019
1025 function formatDateType( $fmt, $date = false )
1026 {
1027 if ( $date === false )
1028 {
1029 $date = time();
1030 }
1031 else if ( empty( $date ) )
1032 {
1033 $date = 0;
1034 }
1035
1036 $text = date( eZLocale::transformToPHPFormat( $fmt, $this->DatePHPArray ), $date );
1037 return str_replace( array( '%D', '%l', '%M', '%F' ),
1038 array( $this->shortDayName( date( 'w', $date ) ),
1039 $this->longDayName( date( 'w', $date ) ),
1040 $this->shortMonthName( date( 'n', $date ) ),
1041 $this->longMonthName( date( 'n', $date ) ) ),
1042 $text );
1043 }
1044
1050 function formatDateTimeType( $fmt, $datetime = false )
1051 {
1052 if ( $datetime === false )
1053 {
1054 $datetime = time();
1055 }
1056 else if ( empty( $datetime ) )
1057 {
1058 $datetime = 0;
1059 }
1060
1061 $text = date( eZLocale::transformToPHPFormat( $fmt, $this->DateTimePHPArray ), $datetime );
1062 // Replace some special 'date' formats that needs to be handled
1063 // internally by the i18n system and not by PHP
1064 return str_replace( array( '%D', '%l', '%M', '%F',
1065 '%a', '%A' ),
1066 array( $this->shortDayName( date( 'w', $datetime ) ),
1067 $this->longDayName( date( 'w', $datetime ) ),
1068 $this->shortMonthName( date( 'n', $datetime ) ),
1069 $this->longMonthName( date( 'n', $datetime ) ),
1070 $this->meridiemName( $datetime, false ),
1071 $this->meridiemName( $datetime, true ) ),
1072 $text );
1073 }
1074
1085 static function transformToPHPFormat( $fmt, $allowed )
1086 {
1087 // This goes trough each of the characters in the format
1088 // string $fmt, if a valid %x character is found it is replaced
1089 // with just x (like date expects).
1090 // It will also escape all characters in the range a-z and A-Z
1091 // expect does that are valid %x formats.
1092 // A special case is formats of the type %%, they will become %
1093 $dateFmt = '';
1094 $offs = 0;
1095 $len = strlen( $fmt );
1096 while ( $offs < $len )
1097 {
1098 $char = $fmt[$offs];
1099 if ( $char == '%' )
1100 {
1101 if ( $offs + 1 < $len )
1102 {
1103 $type = $fmt[$offs + 1];
1104 if ( $type == '%' )
1105 {
1106 $dateFmt .= '%';
1107 }
1108 else if ( ( $type >= 'a' and $type <= 'z' ) or
1109 ( $type >= 'A' and $type <= 'Z' ) )
1110 {
1111 // Escape the $type character if it is not in
1112 // the allowed 'format character' list
1113 if ( !in_array( $type, $allowed ) )
1114 $dateFmt .= '%\\';
1115 $dateFmt .= $type;
1116 }
1117 else
1118 {
1119 $dateFmt .= $char . $type;
1120 }
1121 $offs += 2;
1122 }
1123 else
1124 {
1125 $dateFmt .= '\\' . $char;
1126 ++$offs;
1127 }
1128 }
1129 else
1130 {
1131 // Escape a-zA-Z to avoid PHPs 'date' using them as a 'format character'
1132 if ( ( $char >= 'a' and $char <= 'z' ) or
1133 ( $char >= 'A' and $char <= 'Z' ) )
1134 $dateFmt .= '\\';
1135 $dateFmt .= $char;
1136 ++$offs;
1137 }
1138 }
1139 return $dateFmt;
1140 }
1141
1145 function formatNumber( $number )
1146 {
1147 $neg = $number < 0;
1148 $num = $neg ? -$number : $number;
1149 $text = number_format( $num, $this->FractDigits, $this->DecimalSymbol, $this->ThousandsSeparator );
1150 return ( $neg ? $this->NegativeSymbol : $this->PositiveSymbol ) . $text;
1151 }
1152
1156 function internalNumber( $number )
1157 {
1158 if ( preg_match( '/^(['.$this->PositiveSymbol.']|['.$this->NegativeSymbol.'])?([0-9]*|[0-9]{1,3}(['.$this->ThousandsSeparator.'][0-9]{3,3})*)(['.$this->DecimalSymbol.'][0-9]+)?$/', trim( $number ) ) )
1159 {
1160 $number = str_replace( ' ', '', $number );
1161 if ( $this->PositiveSymbol )
1162 $number = str_replace( $this->PositiveSymbol, '', $number );
1163 $number = str_replace( $this->NegativeSymbol, '-', $number );
1164 $number = str_replace( $this->ThousandsSeparator, '', $number );
1165 $number = str_replace( $this->DecimalSymbol, '.', $number );
1166 }
1167 return $number;
1168 }
1169
1175 function formatCurrency( $number, $as_html = true )
1176 {
1177 return $this->formatCurrencyWithSymbol( $number, $this->CurrencySymbol );
1178 }
1179
1185 function formatCleanCurrency( $number )
1186 {
1187 $text = $this->formatCurrencyWithSymbol( $number, '' );
1188 return trim( $text );
1189 }
1190
1191 function formatCurrencyWithSymbol( $number, $symbol )
1192 {
1193 $neg = $number < 0;
1194 $num = $neg ? -$number : $number;
1195 $num_text = number_format( $num, $this->CurrencyFractDigits,
1196 $this->CurrencyDecimalSymbol, $this->CurrencyThousandsSeparator );
1197 return str_replace( array( '%c', '%p', '%q' ),
1198 array( $symbol,
1199 $neg ? $this->CurrencyNegativeSymbol : $this->CurrencyPositiveSymbol,
1200 $num_text ),
1201 $neg ? $this->CurrencyNegativeFormat : $this->CurrencyPositiveFormat );
1202 }
1203
1204 function translatedCountryNames()
1205 {
1206 return $this->CountryNames;
1207 }
1208
1212 function internalCurrency( $number )
1213 {
1214 if ( preg_match( '/^(['.$this->CurrencyPositiveSymbol.']|['.$this->CurrencyNegativeSymbol.'])?([0-9]*|[0-9]{1,3}(['.$this->ThousandsSeparator.'][0-9]{3,3})*)(['.$this->CurrencyDecimalSymbol.'][0-9]+)?$/', trim( $number ) ) )
1215 {
1216 $number = str_replace( ' ', '', $number );
1217 if ( $this->CurrencyPositiveSymbol )
1218 $number = str_replace( $this->CurrencyPositiveSymbol, '', $number );
1219 $number = str_replace( $this->CurrencyNegativeSymbol, '-', $number );
1220 $number = str_replace( $this->CurrencyThousandsSeparator, '', $number );
1221 $number = str_replace( $this->CurrencyDecimalSymbol, '.', $number );
1222 }
1223 return $number;
1224 }
1225
1239 function shortDayName( $num )
1240 {
1241 if ( $num >= 0 and $num <= 6 )
1242 {
1243 $code = $this->DayNames[$num];
1244 $name = $this->ShortDayNames[$code];
1245 }
1246 else
1247 {
1248 $name = null;
1249 }
1250 return $name;
1251 }
1252
1266 function longDayName( $num )
1267 {
1268 if ( $num >= 0 and $num <= 6 )
1269 {
1270 $code = $this->DayNames[$num];
1271 $name = $this->LongDayNames[$code];
1272 }
1273 else
1274 {
1275 $name = null;
1276 }
1277 return $name;
1278 }
1279
1298 function shortMonthName( $num )
1299 {
1300 if ( $num >= 1 and $num <= 12 )
1301 {
1302 $code = $this->MonthNames[$num];
1303 $name = $this->ShortMonthNames[$code];
1304 }
1305 else
1306 {
1307 $name = null;
1308 }
1309 return $name;
1310 }
1311
1330 function longMonthName( $num )
1331 {
1332 if ( $num >= 1 and $num <= 12 )
1333 {
1334 $code = $this->MonthNames[$num];
1335 $name = $this->LongMonthNames[$code];
1336 }
1337 else
1338 {
1339 $name = null;
1340 }
1341 return $name;
1342 }
1343
1350 static function localeList( $asObject = false, $withVariations = true )
1351 {
1352 $locales =& $GLOBALS['eZLocaleLocaleStringList'];
1353 if ( !is_array( $locales ) )
1354 {
1355 $localeRegexp = eZLocale::localeRegexp( $withVariations, false );
1356 $locales = array();
1357 $dir = opendir( 'share/locale' );
1358 while( ( $file = readdir( $dir ) ) !== false )
1359 {
1360 if ( preg_match( "/^($localeRegexp)\.ini$/", $file, $regs ) )
1361 {
1362 $locales[] = $regs[1];
1363 }
1364 }
1365 closedir( $dir );
1366 $locales = array_unique( $locales );
1367 sort( $locales );
1368 if ( $asObject )
1369 {
1370 $localeObjects = array();
1371 foreach ( $locales as $locale )
1372 {
1373 $localeInstance = eZLocale::instance( $locale );
1374 if ( $localeInstance )
1375 $localeObjects[] = $localeInstance;
1376 }
1377 $locales = $localeObjects;
1378 }
1379 }
1380 return $locales;
1381 }
1382
1389 static function countryList( $withVariations = true )
1390 {
1391 $countries =& $GLOBALS['eZLocaleCountryList'];
1392 if ( !is_array( $countries ) )
1393 {
1394 $localeRegexp = eZLocale::localeRegexp( $withVariations, false );
1395 $countries = array();
1396 $dir = opendir( 'share/locale' );
1397 while( ( $file = readdir( $dir ) ) !== false )
1398 {
1399 if ( preg_match( "/^$localeRegexp\.ini$/", $file, $regs ) )
1400 {
1401 $countries[] = $regs[3];
1402 }
1403 }
1404 closedir( $dir );
1405 $countries = array_unique( $countries );
1406 sort( $countries );
1407 }
1408 return $countries;
1409 }
1410
1417 static function languageList( $withVariations = true )
1418 {
1419 $languages =& $GLOBALS['eZLocaleLanguageist'];
1420 if ( !is_array( $languages ) )
1421 {
1422 $localeRegexp = eZLocale::localeRegexp( $withVariations, false );
1423 $languages = array();
1424 $dir = opendir( 'share/locale' );
1425 while( ( $file = readdir( $dir ) ) !== false )
1426 {
1427 if ( preg_match( "/^$localeRegexp\.ini$/", $file, $regs ) )
1428 {
1429 $languages[] = $regs[1];
1430 }
1431 }
1432 closedir( $dir );
1433 $languages = array_unique( $languages );
1434 sort( $languages );
1435 }
1436 return $languages;
1437 }
1438
1439
1444 function localeFile( $withVariation = false )
1445 {
1446 $type = $withVariation ? 'variation' : 'default';
1447 if ( !( $this->LocaleINI[$type] instanceof eZINI ) )
1448 {
1449 $country = $this->countryCode();
1450 $countryVariation = $this->countryVariation();
1451 $language = $this->languageCode();
1452 $locale = $language;
1453 if ( $country !== '' )
1454 $locale .= '-' . $country;
1455 if ( $withVariation )
1456 {
1457 if ( $countryVariation !== '' )
1458 $locale .= '@' . $countryVariation;
1459 }
1460 $localeFile = $locale . '.ini';
1461 if ( eZLocale::isDebugEnabled() )
1462 {
1463 eZDebug::writeNotice( "Requesting $localeFile", __METHOD__ );
1464 }
1465 if ( eZINI::exists( $localeFile, 'share/locale' ) )
1466 $this->LocaleINI[$type] = eZINI::instance( $localeFile, 'share/locale' );
1467 }
1468 return $this->LocaleINI[$type];
1469 }
1470
1475 function countryFile( $withVariation = false )
1476 {
1477 $type = $withVariation ? 'variation' : 'default';
1478 if ( !( $this->CountryINI[$type] instanceof eZINI ) )
1479 {
1480 $country = $this->countryCode();
1481 $countryVariation = $this->countryVariation();
1482 $locale = $country;
1483 if ( $withVariation )
1484 {
1485 if ( $countryVariation !== '' )
1486 $locale .= '@' . $countryVariation;
1487 }
1488 $countryFile = 'country/' . $locale . '.ini';
1489 if ( eZLocale::isDebugEnabled() )
1490 {
1491 eZDebug::writeNotice( "Requesting $countryFile", __METHOD__ );
1492 }
1493 if ( eZINI::exists( $countryFile, 'share/locale' ) )
1494 $this->CountryINI[$type] = eZINI::instance( $countryFile, 'share/locale' );
1495 }
1496 return $this->CountryINI[$type];
1497 }
1498
1503 function languageFile( $withVariation = false )
1504 {
1505 $type = $withVariation ? 'variation' : 'default';
1506 if ( !( $this->LanguageINI[$type] instanceof eZINI ) )
1507 {
1508 $language = $this->languageCode();
1509 $countryVariation = $this->countryVariation();
1510 $locale = $language;
1511 if ( $withVariation )
1512 {
1513 if ( $countryVariation !== '' )
1514 $locale .= '@' . $countryVariation;
1515 }
1516 $languageFile = 'language/' . $locale . '.ini';
1517 if ( eZLocale::isDebugEnabled() )
1518 {
1519 eZDebug::writeNotice( "Requesting $languageFile", __METHOD__ );
1520 }
1521 if ( eZINI::exists( $languageFile, 'share/locale' ) )
1522 $this->LanguageINI[$type] = eZINI::instance( $languageFile, 'share/locale' );
1523 }
1524 return $this->LanguageINI[$type];
1525 }
1526
1536 static function instance( $localeString = false )
1537 {
1538 if ( $localeString === false )
1539 {
1540 $localeStringDefault =& $GLOBALS["eZLocaleStringDefault"];
1541 if ( !isset( $localeStringDefault ) )
1542 {
1543 $ini = eZINI::instance();
1544 $localeString = $ini->variable( 'RegionalSettings', 'Locale' );
1545 /* Cache this answer to prevent countless calls to retrieve this
1546 * from the INI settings */
1547 $localeStringDefault = $localeString;
1548 }
1549 else
1550 {
1551 /* Used cached version */
1552 $localeString = $localeStringDefault;
1553 }
1554 }
1555
1556 $globalsKey = "eZLocaleInstance_$localeString";
1557
1558 if ( !isset( $GLOBALS[$globalsKey] ) ||
1559 !( $GLOBALS[$globalsKey] instanceof eZLocale ) )
1560 {
1561 $GLOBALS[$globalsKey] = new eZLocale( $localeString );
1562 }
1563 return $GLOBALS[$globalsKey];
1564 }
1565
1570 static function create( $localeString = false )
1571 {
1572 if ( $localeString === false )
1573 {
1574 $ini = eZINI::instance();
1575 $localeString = $ini->variable( 'RegionalSettings', 'Locale' );
1576 }
1577 return new eZLocale( $localeString );
1578 }
1579
1586 static function isDebugEnabled()
1587 {
1588 if ( !isset( $GLOBALS['eZLocaleDebugInternalsEnabled'] ) )
1589 $GLOBALS['eZLocaleDebugInternalsEnabled'] = self::DEBUG_INTERNALS;
1590 return $GLOBALS['eZLocaleDebugInternalsEnabled'];
1591 }
1592
1597 static function setIsDebugEnabled( $debug )
1598 {
1599 $GLOBALS['eZLocaleDebugInternalsEnabled'] = $debug;
1600 }
1601
1605 static function resetGlobals( $localeString = false )
1606 {
1607 if ( $localeString === false )
1608 {
1609 $localeStringDefault =& $GLOBALS["eZLocaleStringDefault"];
1610 if ( isset( $localeStringDefault ) )
1611 {
1612 $localeString = $localeStringDefault;
1613 }
1614 }
1615
1616 unset( $GLOBALS["eZLocaleInstance_$localeString"] );
1617 unset( $GLOBALS["eZLocaleStringDefault"] );
1618 }
1619
1621 public $IsValid;
1623
1625 public $DateFormat;
1628 public $ShortDateFormat;
1630 public $TimeFormat;
1632 public $ShortTimeFormat;
1634 public $MondayFirst;
1636 public $AM, $PM;
1638
1640 public $DecimalSymbol;
1642 public $ThousandsSeparator;
1643 public $FractDigits;
1644 public $NegativeSymbol;
1645 public $PositiveSymbol;
1647
1649 public $CurrencyDecimalSymbol;
1651 public $CurrencyThousandsSeparator;
1652 public $CurrencyFractDigits;
1653 public $CurrencyNegativeSymbol;
1654 public $CurrencyPositiveSymbol;
1655 public $CurrencySymbol;
1656 public $CurrencyPositiveFormat;
1657 public $CurrencyNegativeFormat;
1659
1661 public $DayNames;
1663 public $ShortDayNames, $LongDayNames;
1664 public $MonthNames;
1665 public $ShortMonthNames, $LongMonthNames;
1666 public $WeekDays, $Months;
1667 public $ShortWeekDayNames, $LongWeekDayNames;
1668
1669 public $TimeArray;
1670 public $DateArray;
1671 public $TimePHPArray;
1672 public $TimeSlashInputArray;
1673 public $TimeSlashOutputArray;
1674 public $DateTimeSlashInputArray;
1675 public $DateSlashOutputArray;
1676 public $DateTimeSlashOutputArray;
1677 public $HTTPLocaleCode;
1678 public $functionMap;
1679 public $LocaleCode;
1680 public $TranslationCode;
1681 public $Charset;
1682 public $OverrideCharset;
1683 public $DateTimeFormat;
1684 public $ShortDateTimeFormat;
1685 public $CurrencyName;
1686 public $CurrencyShortName;
1687 public $AllowedCharsets;
1688 public $DateSlashInputArray;
1689 public $DatePHPArray;
1690 public $DateTimeArray;
1691 public $DateTimePHPArray;
1692
1694
1696 public $Country;
1698 public $CountryCode;
1699 public $CountryVariation;
1700 public $CountryComment;
1701 public $LanguageComment;
1702 public $LocaleINI;
1703 public $CountryINI;
1704 public $LanguageINI;
1706 public $LanguageCode;
1708 public $LanguageName;
1710 public $IntlLanguageName;
1711 public $CountryNames;
1713 }
1714
1715 ?>
eZDebug\writeError
static writeError( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:545
eZDebug\writeNotice
static writeNotice( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:459
eZINI
Reads and writes .ini style configuration files.
eZLocale
Provides unified access to locale information and conversions.
Definition: ezlocale.php:111
eZLocale\localeRegexp
static localeRegexp( $withVariations=true, $withCharset=true)
Definition: ezlocale.php:463
eZLocale\resetGlobals
static resetGlobals( $localeString=false)
Definition: ezlocale.php:1605
eZLocale\$LongDayNames
$LongDayNames
Definition: ezlocale.php:1663
eZLocale\httpLocaleCode
httpLocaleCode()
Definition: ezlocale.php:689
eZLocale\internalNumber
internalNumber( $number)
Definition: ezlocale.php:1156
eZLocale\$PositiveSymbol
$PositiveSymbol
Definition: ezlocale.php:1645
eZLocale\$LongWeekDayNames
$LongWeekDayNames
Definition: ezlocale.php:1667
eZLocale\$LocaleCode
$LocaleCode
Definition: ezlocale.php:1679
eZLocale\$DateFormat
$DateFormat
Format of dates.
Definition: ezlocale.php:1626
eZLocale\countryVariation
countryVariation()
Definition: ezlocale.php:641
eZLocale\decimalCount
decimalCount()
Definition: ezlocale.php:785
eZLocale\countryFile
countryFile( $withVariation=false)
Definition: ezlocale.php:1475
eZLocale\internationalLanguageName
internationalLanguageName()
Definition: ezlocale.php:728
eZLocale\$TimePHPArray
$TimePHPArray
Definition: ezlocale.php:1671
eZLocale\$FractDigits
$FractDigits
Definition: ezlocale.php:1643
eZLocale\$TimeSlashOutputArray
$TimeSlashOutputArray
Definition: ezlocale.php:1673
eZLocale\$AM
$AM
AM and PM names.
Definition: ezlocale.php:1636
eZLocale\currencyNegativeSymbol
currencyNegativeSymbol()
Definition: ezlocale.php:833
eZLocale\hasAttribute
hasAttribute( $attribute)
Definition: ezlocale.php:530
eZLocale\$LocaleINI
$LocaleINI
Definition: ezlocale.php:1702
eZLocale\instance
static instance( $localeString=false)
Definition: ezlocale.php:1536
eZLocale\$PM
$PM
Definition: ezlocale.php:1636
eZLocale\currencyPositiveSymbol
currencyPositiveSymbol()
Definition: ezlocale.php:841
eZLocale\languageComment
languageComment()
Definition: ezlocale.php:657
eZLocale\localeList
static localeList( $asObject=false, $withVariations=true)
Definition: ezlocale.php:1350
eZLocale\$DecimalSymbol
$DecimalSymbol
Numbers.
Definition: ezlocale.php:1641
eZLocale\$TimeArray
$TimeArray
Definition: ezlocale.php:1669
eZLocale\$OverrideCharset
$OverrideCharset
Definition: ezlocale.php:1682
eZLocale\countryComment
countryComment()
Definition: ezlocale.php:625
eZLocale\countryName
countryName()
Definition: ezlocale.php:617
eZLocale\$Country
$Country
Objects.
Definition: ezlocale.php:1697
eZLocale\longDayName
longDayName( $num)
Definition: ezlocale.php:1266
eZLocale\formatShortDateTime
formatShortDateTime( $date=false)
Definition: ezlocale.php:1015
eZLocale\initCountry
initCountry(&$countryINI)
Definition: ezlocale.php:325
eZLocale\$TimeSlashInputArray
$TimeSlashInputArray
Definition: ezlocale.php:1672
eZLocale\$CurrencyThousandsSeparator
$CurrencyThousandsSeparator
Definition: ezlocale.php:1651
eZLocale\localeCode
localeCode()
Definition: ezlocale.php:666
eZLocale\isValid
isValid()
Definition: ezlocale.php:317
eZLocale\formatTimeType
formatTimeType( $fmt, $time=false)
Definition: ezlocale.php:953
eZLocale\currentLocaleCode
static currentLocaleCode()
Definition: ezlocale.php:711
eZLocale\formatTime
formatTime( $time=false)
Definition: ezlocale.php:934
eZLocale\DEBUG_INTERNALS
const DEBUG_INTERNALS
Definition: ezlocale.php:113
eZLocale\$functionMap
$functionMap
Definition: ezlocale.php:1678
eZLocale\$IsValid
$IsValid
Definition: ezlocale.php:1621
eZLocale\$CurrencyDecimalSymbol
$CurrencyDecimalSymbol
Currency.
Definition: ezlocale.php:1650
eZLocale\$CountryNames
$CountryNames
Definition: ezlocale.php:1711
eZLocale\transformToPHPFormat
static transformToPHPFormat( $fmt, $allowed)
Definition: ezlocale.php:1085
eZLocale\formatShortTime
formatShortTime( $time=false)
Definition: ezlocale.php:943
eZLocale\formatCleanCurrency
formatCleanCurrency( $number)
Definition: ezlocale.php:1185
eZLocale\create
static create( $localeString=false)
Definition: ezlocale.php:1570
eZLocale\$TimeFormat
$TimeFormat
Format of times.
Definition: ezlocale.php:1630
eZLocale\$ShortWeekDayNames
$ShortWeekDayNames
Definition: ezlocale.php:1667
eZLocale\fetchByHttpLocaleCode
static fetchByHttpLocaleCode( $httpLocaleCode)
Definition: ezlocale.php:918
eZLocale\countryList
static countryList( $withVariations=true)
Definition: ezlocale.php:1389
eZLocale\$DayNames
$DayNames
Help arrays.
Definition: ezlocale.php:1662
eZLocale\weekDayShortNames
weekDayShortNames()
Definition: ezlocale.php:895
eZLocale\translatedCountryNames
translatedCountryNames()
Definition: ezlocale.php:1204
eZLocale\formatDateTime
formatDateTime( $date=false)
Definition: ezlocale.php:1006
eZLocale\getFormattingFunction
getFormattingFunction( $qualifier)
Definition: ezlocale.php:903
eZLocale\localeFile
localeFile( $withVariation=false)
Definition: ezlocale.php:1444
eZLocale\charset
charset()
Definition: ezlocale.php:601
eZLocale\languageName
languageName()
Definition: ezlocale.php:720
eZLocale\$WeekDays
$WeekDays
Definition: ezlocale.php:1666
eZLocale\formatDateType
formatDateType( $fmt, $date=false)
Definition: ezlocale.php:1025
eZLocale\formatDateTimeType
formatDateTimeType( $fmt, $datetime=false)
Definition: ezlocale.php:1050
eZLocale\localeInformation
localeInformation( $localeString)
Definition: ezlocale.php:474
eZLocale\attributes
attributes()
Definition: ezlocale.php:525
eZLocale\$DateTimeArray
$DateTimeArray
Definition: ezlocale.php:1690
eZLocale\$HTTPLocaleCode
$HTTPLocaleCode
Definition: ezlocale.php:1677
eZLocale\languageFile
languageFile( $withVariation=false)
Definition: ezlocale.php:1503
eZLocale\$ShortDateFormat
$ShortDateFormat
Format of short dates.
Definition: ezlocale.php:1628
eZLocale\$CurrencyShortName
$CurrencyShortName
Definition: ezlocale.php:1686
eZLocale\reset
reset()
Definition: ezlocale.php:251
eZLocale\$LanguageINI
$LanguageINI
Definition: ezlocale.php:1704
eZLocale\$CurrencyPositiveFormat
$CurrencyPositiveFormat
Definition: ezlocale.php:1656
eZLocale\$Language
$Language
Definition: ezlocale.php:112
eZLocale\languageCode
languageCode()
Definition: ezlocale.php:649
eZLocale\formatCurrencyWithSymbol
formatCurrencyWithSymbol( $number, $symbol)
Definition: ezlocale.php:1191
eZLocale\$NegativeSymbol
$NegativeSymbol
Definition: ezlocale.php:1644
eZLocale\$LongMonthNames
$LongMonthNames
Definition: ezlocale.php:1665
eZLocale\$ShortDayNames
$ShortDayNames
Definition: ezlocale.php:1663
eZLocale\formatShortDate
formatShortDate( $date=false)
Definition: ezlocale.php:997
eZLocale\currencySymbol
currencySymbol()
Definition: ezlocale.php:736
eZLocale\currencyThousandsSeparator
currencyThousandsSeparator()
Definition: ezlocale.php:817
eZLocale\monthsNames
monthsNames()
Definition: ezlocale.php:869
eZLocale\$MondayFirst
$MondayFirst
True if monday is the first day of the week.
Definition: ezlocale.php:1634
eZLocale\decimalSymbol
decimalSymbol()
Definition: ezlocale.php:769
eZLocale\$CountryINI
$CountryINI
Definition: ezlocale.php:1703
eZLocale\formatCurrency
formatCurrency( $number, $as_html=true)
Definition: ezlocale.php:1175
eZLocale\thousandsSeparator
thousandsSeparator()
Definition: ezlocale.php:777
eZLocale\$LanguageComment
$LanguageComment
Definition: ezlocale.php:1701
eZLocale\$ShortTimeFormat
$ShortTimeFormat
Format of short times.
Definition: ezlocale.php:1632
eZLocale\isDebugEnabled
static isDebugEnabled()
Definition: ezlocale.php:1586
eZLocale\$DatePHPArray
$DatePHPArray
Definition: ezlocale.php:1689
eZLocale\longMonthName
longMonthName( $num)
Definition: ezlocale.php:1330
eZLocale\$CurrencyFractDigits
$CurrencyFractDigits
Definition: ezlocale.php:1652
eZLocale\weekDays
weekDays()
Definition: ezlocale.php:851
eZLocale\$ThousandsSeparator
$ThousandsSeparator
Definition: ezlocale.php:1642
eZLocale\languageList
static languageList( $withVariations=true)
Definition: ezlocale.php:1417
eZLocale\attributeFunctionMap
attributeFunctionMap()
Definition: ezlocale.php:560
eZLocale\weekDayNames
weekDayNames( $short=false)
Definition: ezlocale.php:877
eZLocale\$CountryCode
$CountryCode
Definition: ezlocale.php:1698
eZLocale\$CurrencyNegativeFormat
$CurrencyNegativeFormat
Definition: ezlocale.php:1657
eZLocale\initLanguage
initLanguage(&$languageINI)
Definition: ezlocale.php:364
eZLocale\$DateTimeSlashOutputArray
$DateTimeSlashOutputArray
Definition: ezlocale.php:1676
eZLocale\positiveSymbol
positiveSymbol()
Definition: ezlocale.php:801
eZLocale\$CountryVariation
$CountryVariation
Definition: ezlocale.php:1699
eZLocale\$DateTimeSlashInputArray
$DateTimeSlashInputArray
Definition: ezlocale.php:1674
eZLocale\attribute
attribute( $attribute)
Definition: ezlocale.php:539
eZLocale\shortMonthName
shortMonthName( $num)
Definition: ezlocale.php:1298
eZLocale\$MonthNames
$MonthNames
Definition: ezlocale.php:1664
eZLocale\$ShortMonthNames
$ShortMonthNames
Definition: ezlocale.php:1665
eZLocale\shortDayName
shortDayName( $num)
Definition: ezlocale.php:1239
eZLocale\meridiemName
meridiemName( $time=false, $upcase=false)
Definition: ezlocale.php:973
eZLocale\$Months
$Months
Definition: ezlocale.php:1666
eZLocale\internalCurrency
internalCurrency( $number)
Definition: ezlocale.php:1212
eZLocale\isMondayFirst
isMondayFirst()
Definition: ezlocale.php:761
eZLocale\$ShortDateTimeFormat
$ShortDateTimeFormat
Definition: ezlocale.php:1684
eZLocale\$Charset
$Charset
Definition: ezlocale.php:1681
eZLocale\$CountryComment
$CountryComment
Definition: ezlocale.php:1700
eZLocale\localeFullCode
localeFullCode()
Definition: ezlocale.php:674
eZLocale\countryCode
countryCode()
Definition: ezlocale.php:633
eZLocale\negativeSymbol
negativeSymbol()
Definition: ezlocale.php:793
eZLocale\$DateSlashOutputArray
$DateSlashOutputArray
Definition: ezlocale.php:1675
eZLocale\months
months()
Definition: ezlocale.php:860
eZLocale\currencyName
currencyName()
Definition: ezlocale.php:744
eZLocale\currencyDecimalSymbol
currencyDecimalSymbol()
Definition: ezlocale.php:809
eZLocale\$CurrencyPositiveSymbol
$CurrencyPositiveSymbol
Definition: ezlocale.php:1654
eZLocale\initPHP
initPHP( $charset=false)
Definition: ezlocale.php:518
eZLocale\$DateArray
$DateArray
Definition: ezlocale.php:1670
eZLocale\$AllowedCharsets
$AllowedCharsets
Definition: ezlocale.php:1687
eZLocale\$DateTimeFormat
$DateTimeFormat
Definition: ezlocale.php:1683
eZLocale\$DateSlashInputArray
$DateSlashInputArray
Definition: ezlocale.php:1688
eZLocale\__construct
__construct( $localeString)
Definition: ezlocale.php:121
eZLocale\$TranslationCode
$TranslationCode
Definition: ezlocale.php:1680
eZLocale\$CurrencyNegativeSymbol
$CurrencyNegativeSymbol
Definition: ezlocale.php:1653
eZLocale\$CurrencySymbol
$CurrencySymbol
Definition: ezlocale.php:1655
eZLocale\formatNumber
formatNumber( $number)
Definition: ezlocale.php:1145
eZLocale\$CurrencyName
$CurrencyName
Definition: ezlocale.php:1685
eZLocale\allowedCharsets
allowedCharsets()
Definition: ezlocale.php:609
eZLocale\formatDate
formatDate( $date=false)
Definition: ezlocale.php:988
eZLocale\$DateTimePHPArray
$DateTimePHPArray
Definition: ezlocale.php:1691
eZLocale\$LanguageName
$LanguageName
Name of the language.
Definition: ezlocale.php:1708
eZLocale\currencyShortName
currencyShortName()
Definition: ezlocale.php:752
eZLocale\$IntlLanguageName
$IntlLanguageName
Internationalized name of the language.
Definition: ezlocale.php:1710
eZLocale\$LanguageCode
$LanguageCode
The language code, for instance nor-NO, or eng-GB.
Definition: ezlocale.php:1706
eZLocale\setIsDebugEnabled
static setIsDebugEnabled( $debug)
Definition: ezlocale.php:1597
eZLocale\currencyDecimalCount
currencyDecimalCount()
Definition: ezlocale.php:825
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.