Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
eZLocale Class Reference

## Public Member Functions
| __construct ( $iso="")
& | format (&$obj, $isShort=true)
& | dayName ( $day, $isShort=true)
& | monthName ( $month, $isShort=true)
| formatNumber ( $value)
| mondayFirst ()
| languageISO ()
| setSymbol ( $value)
| setPrefixSymbol ( $value)
| ampm ( $hour, $uppercase=true)
| twelveHour ( $hour)

## Static Public Member Functions
static | addZero ( $value)

## Public Attributes
| $PositivePrefixCurrencySymbol
| $NegativePrefixCurrencySymbol
| $LanguageISO
| $CurrencySymbol
| $DecimalSymbol
| $ThousandsSymbol
| $FractDigits
| $TimeFormat
| $ShortTimeFormat
| $DateFormat
| $ShortDateFormat
| $MondayFirst
| $LocaleIni

## Detailed Description

! eZCommon The eZLocale class provides locale functions.

eZLocale handles locale information and formats time, date, and currency information to the locale format.

The following characters are recognized in the date/time format.

    a - "am" or "pm"
    A - "AM" or "PM"
    d - day of the month, 2 digits with leading zeros; i.e. "01" to "31"
    D - day of the week, textual, 3 letters; i.e. "Fri"
    E - day of the week, textual, long; i.e. "Friday"
    F - month, textual, long; i.e. "January"
    g - hour, 12-hour format without leading zeros; i.e. "1" to "12"
    G - hour, 24-hour format without leading zeros; i.e. "0" to "23"
    h - hour, 12-hour format; i.e. "01" to "12"
    H - hour, 24-hour format; i.e. "00" to "23"
    i - minutes; i.e. "00" to "59"
    j - day of the month without leading zeros; i.e. "1" to "31"
    M - month, textual, 3 letters; i.e. "Jan"
    m - month; i.e. "01" to "12"
    n - month without leading zeros; i.e. "1" to "12"
    s - seconds; i.e. "00" to "59"
    t - number of days in the given month; i.e. "28" to "31"
    Y - year, 4 digits; i.e. "1999"
    y - year, 2 digits; i.e. "99"

The following are not yet implemented.

    I (capital i) - "1" if Daylight Savings Time, "0" otherwise.
    L - boolean for whether it is a leap year; i.e. "0" or "1"
    T - Timezone setting of this machine; i.e. "MDT"
    U - seconds since the epoch
    V - The ISO 8601:1988 week number of the current year as a decimal number,
        range 01 to 53, where week 1 is the first week that has at least 4 days
        in the current year, and with Monday as the first day of the week.
    w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday)
    W - week number of the current year as a decimal number, starting with the
        first Monday as the first day of the first week.
    z - day of the year; i.e. "0" to "365"
    Z - timezone offset in seconds (i.e. "-43200" to "43200")

Example:

include_once( "kernel/classes/ezdate.php" );
include_once( "kernel/classes/ezcurrency.php" );
include_once( "kernel/classes/ezlocale.php" );
include_once( "kernel/classes/eztime.php" );
$locale = new eZLocale( "no_NO" );
$date = new eZDate( 2000, 9, 2 );
$date2 = new eZDate( );
$date2->setMySQLDate( "2000-12-02" );
$time = new eZTime( 12, 2, 23 );
$currency = new eZCurrency( 4333222111.998877 );
print( "Norwegian<br>" );
print( "Localized date: " . $locale->format( $date ) . "<br>" );
print( "Localized date: " . $locale->format( $date, false ) . "<br>" );
print( "Localized date: " . $locale->format( $date2 ) . "<br>" );
print( "Localized time: " . $locale->format( $time ) . "<br>" );
print( "Localized currency: " . $locale->format( $currency ) . "<br>" );
$time->setMySQLTime( "13:37:12" );
$locale = new eZLocale( );
print( "UK English<br>" );
print( "Localized date: " . $locale->format( $date ) . "<br>" );
print( "Localized date: " . $locale->format( $date, false ) . "<br>" );
print( "Localized time: " . $locale->format( $time ) . "<br>" );
print( "Localized currency: " . $locale->format( $currency ) . "<br>" );
$locale
$locale
Definition: admin/adlist.php:127
$date
$date
Definition: bugpreview.php:66
eZCurrency
Definition: ezcurrency.php:46
eZDate
Definition: ezdate.php:46
eZLocale
Definition: ezlocale.php:119
eZTime
Definition: eztime.php:38
$currency
$currency
Definition: companyview.php:529
$time
$time
Definition: homepage.php:327

See also
  eZDate eZDateTime eZTime eZCurrency eZNumber

Definition at line 118 of file ezlocale.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZLocale::__construct | ( |  | $iso = `""` | ) |

Constructs a new eZLocale object. If an ISO code is given as an argument the regional file for that language is used. Otherwise the default regional settings are used.

Definition at line 125 of file ezlocale.php.

References $ini, and file_exists().

## Member Function Documentation

## ◆ addZero()

static eZLocale::addZero | ( |  | $value | ) |
| static

Adds a "0" in front of the value if it's below 10.

Definition at line 524 of file ezlocale.php.

References $ret.

Referenced by format().

## ◆ ampm()

eZLocale::ampm | ( |  | $hour,
|  |  | $uppercase = `true`
| ) |  |

Returns AM or PM based on the supplied hour value. $hour must be between 0 and 23. If $uppercase is true, the string will be returned in upper case, else in lower case.

Definition at line 565 of file ezlocale.php.

References $hour, and $ret.

Referenced by format().

## ◆ dayName()

& eZLocale::dayName | ( |  | $day,
|  |  | $isShort = `true`
| ) |  |

Returns the day name, translated to the local language.

$day must either be a number from 1-7, or the three first letters of the day name in English, lowercase. If isShort is set to false then the complete version of the name is used, otherwise a three letter version is used.

Definition at line 314 of file ezlocale.php.

References $day, $name, and mondayFirst().

Referenced by format().

## ◆ format()

& eZLocale::format | ( | & | $obj,
|  |  | $isShort = `true`
| ) |  |

Returns a nicely formatted string. This function automatically finds the appropriate format to use based on locale information and the type of object passed as an argument.

If isShort is set to false then the long version of the string is used, if it exists.

Definition at line 163 of file ezlocale.php.

References $CurrencySymbol, $date, $DateFormat, $ShortDateFormat, $ShortTimeFormat, $time, $TimeFormat, addZero(), ampm(), dayName(), monthName(), and twelveHour().

## ◆ formatNumber()

eZLocale::formatNumber | ( |  | $value | ) |

Definition at line 481 of file ezlocale.php.

## ◆ languageISO()

eZLocale::languageISO | ( |  | ) |

Returns the ISO code of the current language, or false if it is not specified. (it should be)

Definition at line 512 of file ezlocale.php.

References $LanguageISO.

## ◆ mondayFirst()

eZLocale::mondayFirst | ( |  | ) |

Returns true if monday is the first day of the week, else false.

Definition at line 496 of file ezlocale.php.

Referenced by dayName().

## ◆ monthName()

& eZLocale::monthName | ( |  | $month,
|  |  | $isShort = `true`
| ) |  |

Returns the month name, translated to the local language.

$month must either be a number from 1-12, or the three first letters of the month name in English, lowercase. If isShort is set to false then the complete version of the name is used, otherwise a three letter version is used.

Definition at line 389 of file ezlocale.php.

References $month, and $name.

Referenced by format().

## ◆ setPrefixSymbol()

eZLocale::setPrefixSymbol | ( |  | $value | ) |

Sets both negative and possitive prefix symbol.

Definition at line 546 of file ezlocale.php.

## ◆ setSymbol()

eZLocale::setSymbol | ( |  | $value | ) |

Sets the currency symbol.

Definition at line 538 of file ezlocale.php.

## ◆ twelveHour()

eZLocale::twelveHour | ( |  | $hour | ) |

Returns the hour of the day in 12-hour format. $hour must be between 0 and 23.

Definition at line 582 of file ezlocale.php.

References $hour.

Referenced by format().

## Member Data Documentation

## ◆ $CurrencySymbol

eZLocale::$CurrencySymbol

Definition at line 597 of file ezlocale.php.

Referenced by format().

## ◆ $DateFormat

eZLocale::$DateFormat

Definition at line 603 of file ezlocale.php.

Referenced by format().

## ◆ $DecimalSymbol

eZLocale::$DecimalSymbol

Definition at line 598 of file ezlocale.php.

## ◆ $FractDigits

eZLocale::$FractDigits

Definition at line 600 of file ezlocale.php.

## ◆ $LanguageISO

eZLocale::$LanguageISO

Definition at line 596 of file ezlocale.php.

Referenced by languageISO().

## ◆ $LocaleIni

eZLocale::$LocaleIni

Definition at line 607 of file ezlocale.php.

## ◆ $MondayFirst

eZLocale::$MondayFirst

Definition at line 605 of file ezlocale.php.

## ◆ $NegativePrefixCurrencySymbol

eZLocale::$NegativePrefixCurrencySymbol

Definition at line 594 of file ezlocale.php.

## ◆ $PositivePrefixCurrencySymbol

eZLocale::$PositivePrefixCurrencySymbol

Definition at line 593 of file ezlocale.php.

## ◆ $ShortDateFormat

eZLocale::$ShortDateFormat

Definition at line 604 of file ezlocale.php.

Referenced by format().

## ◆ $ShortTimeFormat

eZLocale::$ShortTimeFormat

Definition at line 602 of file ezlocale.php.

Referenced by format().

## ◆ $ThousandsSymbol

eZLocale::$ThousandsSymbol

Definition at line 599 of file ezlocale.php.

## ◆ $TimeFormat

eZLocale::$TimeFormat

Definition at line 601 of file ezlocale.php.

Referenced by format().

The documentation for this class was generated from the following file:

- ezlocale.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.