Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

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

Provides unified access to locale information and conversions. More...

## Public Member Functions
| __construct ( $localeString)
| isValid ()
| localeInformation ( $localeString)
| initPHP ( $charset=false)
| attributes ()
| hasAttribute ( $attribute)
| attribute ( $attribute)
| attributeFunctionMap ()
| charset ()
| allowedCharsets ()
| countryName ()
| countryComment ()
| countryCode ()
| countryVariation ()
| languageCode ()
| languageComment ()
| localeCode ()
| localeFullCode ()
| httpLocaleCode ()
| languageName ()
| internationalLanguageName ()
| currencySymbol ()
| currencyName ()
| currencyShortName ()
| isMondayFirst ()
| decimalSymbol ()
| thousandsSeparator ()
| decimalCount ()
| negativeSymbol ()
| positiveSymbol ()
| currencyDecimalSymbol ()
| currencyThousandsSeparator ()
| currencyDecimalCount ()
| currencyNegativeSymbol ()
| currencyPositiveSymbol ()
| weekDays ()
| months ()
| monthsNames ()
| weekDayNames ( $short=false)
| weekDayShortNames ()
| getFormattingFunction ( $qualifier)
| formatTime ( $time=false)
| formatShortTime ( $time=false)
| formatTimeType ( $fmt, $time=false)
| meridiemName ( $time=false, $upcase=false)
| formatDate ( $date=false)
| formatShortDate ( $date=false)
| formatDateTime ( $date=false)
| formatShortDateTime ( $date=false)
| formatDateType ( $fmt, $date=false)
| formatDateTimeType ( $fmt, $datetime=false)
| formatNumber ( $number)
| internalNumber ( $number)
| formatCurrency ( $number, $as_html=true)
| formatCleanCurrency ( $number)
| formatCurrencyWithSymbol ( $number, $symbol)
| translatedCountryNames ()
| internalCurrency ( $number)
| shortDayName ( $num)
| longDayName ( $num)
| shortMonthName ( $num)
| longMonthName ( $num)
| localeFile ( $withVariation=false)
| countryFile ( $withVariation=false)
| languageFile ( $withVariation=false)

## Static Public Member Functions
static | localeRegexp ( $withVariations=true, $withCharset=true)
static | currentLocaleCode ()
static | fetchByHttpLocaleCode ( $httpLocaleCode)
static | localeList ( $asObject=false, $withVariations=true)
static | countryList ( $withVariations=true)
static | languageList ( $withVariations=true)
static | instance ( $localeString=false)
static | create ( $localeString=false)
static | isDebugEnabled ()
static | setIsDebugEnabled ( $debug)
static | resetGlobals ( $localeString=false)

## Public Attributes
| $Language
const | DEBUG_INTERNALS = false
| $IsValid
| $DateFormat
| Format of dates. More...
| $ShortDateFormat
| Format of short dates. More...
| $TimeFormat
| Format of times. More...
| $ShortTimeFormat
| Format of short times. More...
| $MondayFirst
| True if monday is the first day of the week. More...
| $AM
| AM and PM names. More...
| $PM
| $DecimalSymbol
| Numbers. More...
| $ThousandsSeparator
| $FractDigits
| $NegativeSymbol
| $PositiveSymbol
| $CurrencyDecimalSymbol
| Currency. More...
| $CurrencyThousandsSeparator
| $CurrencyFractDigits
| $CurrencyNegativeSymbol
| $CurrencyPositiveSymbol
| $CurrencySymbol
| $CurrencyPositiveFormat
| $CurrencyNegativeFormat
| $DayNames
| Help arrays. More...
| $ShortDayNames
| $LongDayNames
| $MonthNames
| $ShortMonthNames
| $LongMonthNames
| $WeekDays
| $Months
| $ShortWeekDayNames
| $LongWeekDayNames
| $TimeArray
| $DateArray
| $TimePHPArray
| $TimeSlashInputArray
| $TimeSlashOutputArray
| $DateTimeSlashInputArray
| $DateSlashOutputArray
| $DateTimeSlashOutputArray
| $HTTPLocaleCode
| $functionMap
| $LocaleCode
| $TranslationCode
| $Charset
| $OverrideCharset
| $DateTimeFormat
| $ShortDateTimeFormat
| $CurrencyName
| $CurrencyShortName
| $AllowedCharsets
| $DateSlashInputArray
| $DatePHPArray
| $DateTimeArray
| $DateTimePHPArray
| $Country
| Objects. More...
| $CountryCode
| $CountryVariation
| $CountryComment
| $LanguageComment
| $LocaleINI
| $CountryINI
| $LanguageINI
| $LanguageCode
| The language code, for instance nor-NO, or eng-GB. More...
| $LanguageName
| Name of the language. More...
| $IntlLanguageName
| Internationalized name of the language. More...
| $CountryNames

## Private Member Functions
| reset ()
| initCountry (&$countryINI)
| initLanguage (&$languageINI)

## Static Private Member Functions
static | transformToPHPFormat ( $fmt, $allowed)

## Detailed Description

Provides unified access to locale information and conversions.

The eZLocale class handles locale information and can format time, date, numbers and currency for correct display for a given locale. The locale conversion uses plain numerical values for dates, times, numbers and currency, if you want more elaborate conversions consider using the eZDate, eZTime, eZDateTime and eZCurrency classes.

The first time a locale object is created (ie. eZLocale::instance() ) you must be sure to set a language using setLanguage before using any textual conversions.

Example:

// Fetch the default values supplied by site.ini
$locale = eZLocale::instance();
// Make sure PHP is to the correct locale
$locale->initPHP();
print( $locale->formatTime() . '<br>' ); // Display current time
print( $locale->formatDate() . '<br>' ); // Display current day
foreach ( $locale->weekDays() as $day ) // Print a week with 3 letter daynames
{
print( $locale->shortDayName( $day ) . '<br>' );
}
eZLocale\instance
static instance( $localeString=false)
Definition: ezlocale.php:1536

Countries are specified by the ISO 3166 Country Code http://www.iso.ch/iso/en/prods-services/iso3166ma/index.html User-assigned code elements http://www.iso.ch/iso/en/prods-services/iso3166ma/04background-on-iso-3166/reserved-and-user-assigned-codes.html#userassigned

Language is specified by the ISO 639 Language Code http://www.w3.org/WAI/ER/IG/ert/iso639.htm

Currency/funds are specified by the ISO 4217 http://www.bsi-global.com/Technical+Information/Publications/_Publications/tig90.xalter

Discussion on Norwegian locales https://lister.ping.uio.no/pipermail/lister.ping.uio.no/i18n-nn/2002-April.txt http://www.sprakrad.no/oss.htm

The date and time formats are quite similar to the builtin PHP date function, the main differences are those which returns textual representations of months and days. More info on the date function here: http://www.php.net/manual/en/function.date.php

The following characters are not recognized in the format string:

- B - Swatch Internet time
- S - English ordinal suffix for the day of the month, 2 characters; i.e. "st", "nd", "rd" or "th"

The following characters are recognized in the format string:

- 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; e.g. "Fri"
- F - month, textual, long; e.g. "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"
- I (capital i) - "1" if Daylight Savings Time, "0" otherwise.
- j - day of the month without leading zeros; i.e. "1" to "31"
- l (lowercase 'L') - day of the week, textual, long; e.g. "Friday"
- L - boolean for whether it is a leap year; i.e. "0" or "1"
- m - month; i.e. "01" to "12"
- M - month, textual, 3 letters; e.g. "Jan"
- n - month without leading zeros; i.e. "1" to "12"
- O - Difference to Greenwich time in hours; e.g. "+0200"
- s - seconds; i.e. "00" to "59"
- t - number of days in the given month; i.e. "28" to "31"
- T - Timezone setting of this machine; e.g. "EST" or "MDT"
- U - seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
- w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday)
- W - ISO-8601 week number of year, weeks starting on Monday (added in PHP 4.1.0)
- Y - year, 4 digits; e.g. "1999"
- y - year, 2 digits; e.g. "99"
- z - day of the year; i.e. "0" to "365"
- Z - timezone offset in seconds (i.e. "-43200" to "43200"). The offset for timezones west of UTC is always negative, and for those east of UTC is always positive.
- c - ISO 8601 date; i.e. 2004-02-12T15:19:21+00:00
- r - RFC 2822 formated date; i.e. Thu, 21 Dec 2000 16:01:07 +0200

See also
  eZLanguage

Definition at line 110 of file ezlocale.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZLocale::__construct | ( |  | $localeString | ) |

Initializes the locale with the locale string $localeString. All locale data is read from locale/$localeString.ini

Parameters

  string | $localeString |

Definition at line 121 of file ezlocale.php.

References countryFile(), countryVariation(), initCountry(), initLanguage(), languageFile(), localeFile(), localeInformation(), reset(), and eZDebug\writeError().

## Member Function Documentation

## ◆ allowedCharsets()

eZLocale::allowedCharsets | ( |  | ) |

Returns
  an array with charsets that this locale can work with.

Definition at line 609 of file ezlocale.php.

References $AllowedCharsets.

## ◆ attribute()

eZLocale::attribute | ( |  | $attribute | ) |

Definition at line 539 of file ezlocale.php.

References attributeFunctionMap(), and eZDebug\writeError().

## ◆ attributeFunctionMap()

eZLocale::attributeFunctionMap | ( |  | ) |

Definition at line 560 of file ezlocale.php.

Referenced by attribute(), attributes(), and hasAttribute().

## ◆ attributes()

eZLocale::attributes | ( |  | ) |

Definition at line 525 of file ezlocale.php.

References attributeFunctionMap().

## ◆ charset()

eZLocale::charset | ( |  | ) |

Returns the charset for this locale.

Note
  It returns an empty string if no charset was set from the locale file.

Definition at line 601 of file ezlocale.php.

References $Charset.

## ◆ countryCode()

eZLocale::countryCode | ( |  | ) |

Returns the code for the country. eg. 'NO'

Definition at line 633 of file ezlocale.php.

References $CountryCode.

Referenced by countryFile(), and localeFile().

## ◆ countryComment()

eZLocale::countryComment | ( |  | ) |

Returns the comment for the country, if any.

Definition at line 625 of file ezlocale.php.

References $CountryComment.

## ◆ countryFile()

eZLocale::countryFile | ( |  | $withVariation = `false` | ) |

Returns the eZINI object for the country ini file.

Warning
  Do not modify this object.

Definition at line 1475 of file ezlocale.php.

References countryCode(), countryVariation(), isDebugEnabled(), and eZDebug\writeNotice().

Referenced by __construct().

## ◆ countryList()

static eZLocale::countryList | ( |  | $withVariations = `true` | ) |
| static

Returns
  a list of countries which was found in the system, the countries are in identifier form, for instance: NO, GB, US

Parameters

  $withVariations | If `true` it will include variations of locales (ends with @identifier)

Definition at line 1389 of file ezlocale.php.

References localeRegexp().

## ◆ countryName()

eZLocale::countryName | ( |  | ) |

Returns the name of the country in British English.

Definition at line 617 of file ezlocale.php.

References $Country.

## ◆ countryVariation()

eZLocale::countryVariation | ( |  | ) |

Returns the variation for the country. eg. 'spraakraad'

Definition at line 641 of file ezlocale.php.

References $CountryVariation.

Referenced by __construct(), countryFile(), languageFile(), localeFile(), and localeFullCode().

## ◆ create()

static eZLocale::create | ( |  | $localeString = `false` | ) |
| static

Similar to instance() but will always create a new copy.

Definition at line 1570 of file ezlocale.php.

## ◆ currencyDecimalCount()

eZLocale::currencyDecimalCount | ( |  | ) |

Returns
  the number of decimals for currencies.

Definition at line 825 of file ezlocale.php.

References $CurrencyFractDigits.

## ◆ currencyDecimalSymbol()

eZLocale::currencyDecimalSymbol | ( |  | ) |

Returns
  the decimal symbol for currencies.

Definition at line 809 of file ezlocale.php.

References $CurrencyDecimalSymbol.

## ◆ currencyName()

eZLocale::currencyName | ( |  | ) |

Returns the name of the currency.

Definition at line 744 of file ezlocale.php.

References $CurrencyName.

## ◆ currencyNegativeSymbol()

eZLocale::currencyNegativeSymbol | ( |  | ) |

Returns
  the negative symbol for currencies.

Definition at line 833 of file ezlocale.php.

References $CurrencyNegativeSymbol.

## ◆ currencyPositiveSymbol()

eZLocale::currencyPositiveSymbol | ( |  | ) |

Returns
  the positive symbol for currencies.

Definition at line 841 of file ezlocale.php.

References $CurrencyPositiveSymbol.

## ◆ currencyShortName()

eZLocale::currencyShortName | ( |  | ) |

Returns the short name of the currency.

Definition at line 752 of file ezlocale.php.

References $CurrencyShortName.

## ◆ currencySymbol()

eZLocale::currencySymbol | ( |  | ) |

Returns the currency symbol for this locale.

Definition at line 736 of file ezlocale.php.

References $CurrencySymbol.

## ◆ currencyThousandsSeparator()

eZLocale::currencyThousandsSeparator | ( |  | ) |

Returns
  the thousand separator for currencies.

Definition at line 817 of file ezlocale.php.

References $CurrencyThousandsSeparator.

## ◆ currentLocaleCode()

static eZLocale::currentLocaleCode | ( |  | ) |
| static

Returns the current locale code for this language which is the language and the country with a dash (-) between them, for instance nor-NO or eng-GB.

See also
  localeCode, instance

Definition at line 711 of file ezlocale.php.

References instance().

## ◆ decimalCount()

eZLocale::decimalCount | ( |  | ) |

Returns
  the number of decimals for normal numbers.

Definition at line 785 of file ezlocale.php.

References $FractDigits.

## ◆ decimalSymbol()

eZLocale::decimalSymbol | ( |  | ) |

Returns
  the decimal symbol for normal numbers.

Definition at line 769 of file ezlocale.php.

References $DecimalSymbol.

## ◆ fetchByHttpLocaleCode()

static eZLocale::fetchByHttpLocaleCode | ( |  | $httpLocaleCode | ) |
| static

Returns eZLocale object by HTTP locale code $httpLocaleCode

Definition at line 918 of file ezlocale.php.

References localeList().

## ◆ formatCleanCurrency()

eZLocale::formatCleanCurrency | ( |  | $number | ) |

Formats the same as formatCurrency, but drops the currency sign

Parameters

  currency | input

Definition at line 1185 of file ezlocale.php.

References formatCurrencyWithSymbol().

## ◆ formatCurrency()

eZLocale::formatCurrency | ( |  | $number,
|  |  | $as_html = `true`
| ) |  |

Deprecated:
  Formats the currency $number according to locale information and returns it. If $as_html is true all spaces are converted to before being returned.

Definition at line 1175 of file ezlocale.php.

References formatCurrencyWithSymbol().

## ◆ formatCurrencyWithSymbol()

eZLocale::formatCurrencyWithSymbol | ( |  | $number,
|  |  | $symbol
| ) |  |

Definition at line 1191 of file ezlocale.php.

Referenced by formatCleanCurrency(), and formatCurrency().

## ◆ formatDate()

eZLocale::formatDate | ( |  | $date = `false` | ) |

Formats the date $date according to locale information and returns it. If $date is not specified the current date is used.

Definition at line 988 of file ezlocale.php.

References formatDateType().

## ◆ formatDateTime()

eZLocale::formatDateTime | ( |  | $date = `false` | ) |

Formats the date and time $date according to locale information and returns it. If $date is not specified the current date is used.

Definition at line 1006 of file ezlocale.php.

References formatDateTimeType().

## ◆ formatDateTimeType()

eZLocale::formatDateTimeType | ( |  | $fmt,
|  |  | $datetime = `false`
| ) |  |

Formats the date and time $datetime according to the format $fmt. You shouldn't call this directly unless you want to deviate from the locale settings.

See also
  formatDateTime(), formatShortDateTime()

Definition at line 1050 of file ezlocale.php.

References longDayName(), longMonthName(), meridiemName(), shortDayName(), shortMonthName(), and transformToPHPFormat().

Referenced by formatDateTime(), and formatShortDateTime().

## ◆ formatDateType()

eZLocale::formatDateType | ( |  | $fmt,
|  |  | $date = `false`
| ) |  |

Formats the date $date according to the format $fmt. You shouldn't call this directly unless you want to deviate from the locale settings.

See also
  formatDate(), formatShortDate()

Definition at line 1025 of file ezlocale.php.

References longDayName(), longMonthName(), shortDayName(), shortMonthName(), and transformToPHPFormat().

Referenced by formatDate(), and formatShortDate().

## ◆ formatNumber()

eZLocale::formatNumber | ( |  | $number | ) |

Formats the number $number according to locale information and returns it.

Definition at line 1145 of file ezlocale.php.

## ◆ formatShortDate()

eZLocale::formatShortDate | ( |  | $date = `false` | ) |

Formats the date $date according to locale information for short dates and returns it. If $date is not specified the current date is used.

Definition at line 997 of file ezlocale.php.

References formatDateType().

## ◆ formatShortDateTime()

eZLocale::formatShortDateTime | ( |  | $date = `false` | ) |

Formats the date and time $date according to locale information for short dates and returns it. If $date is not specified the current date is used.

Definition at line 1015 of file ezlocale.php.

References formatDateTimeType().

## ◆ formatShortTime()

eZLocale::formatShortTime | ( |  | $time = `false` | ) |

Formats the time $time according to locale information for short times and returns it. If $time is not specified the current time is used.

Definition at line 943 of file ezlocale.php.

References formatTimeType().

## ◆ formatTime()

eZLocale::formatTime | ( |  | $time = `false` | ) |

Formats the time $time according to locale information and returns it. If $time is not specified the current time is used.

Definition at line 934 of file ezlocale.php.

References formatTimeType().

## ◆ formatTimeType()

eZLocale::formatTimeType | ( |  | $fmt,
|  |  | $time = `false`
| ) |  |

Formats the time $time according to the format $fmt. You shouldn't call this directly unless you want to deviate from the locale settings.

See also
  formatTime(), formatShortTime()

Definition at line 953 of file ezlocale.php.

References meridiemName(), and transformToPHPFormat().

Referenced by formatShortTime(), and formatTime().

## ◆ getFormattingFunction()

eZLocale::getFormattingFunction | ( |  | $qualifier | ) |

Returns the method name belonging to a qualifier

Definition at line 903 of file ezlocale.php.

## ◆ hasAttribute()

eZLocale::hasAttribute | ( |  | $attribute | ) |

Definition at line 530 of file ezlocale.php.

References attributeFunctionMap().

## ◆ httpLocaleCode()

eZLocale::httpLocaleCode | ( |  | ) |

Returns
  the locale code which can be set in either HTTP headers or the HTML file. The locale code is first check for in the RegionalSettings/HTTPLocale setting in site.ini, if that is empty it will use the value from localeCode().

See also
  localeCode

Definition at line 689 of file ezlocale.php.

References $HTTPLocaleCode, and localeCode().

## ◆ initCountry()

eZLocale::initCountry | ( | & | $countryINI | ) |
| private

Definition at line 325 of file ezlocale.php.

Referenced by __construct().

## ◆ initLanguage()

eZLocale::initLanguage | ( | & | $languageINI | ) |
| private

Definition at line 364 of file ezlocale.php.

Referenced by __construct().

## ◆ initPHP()

eZLocale::initPHP | ( |  | $charset = `false` | ) |

Sets locale information in PHP. This means that some of the string/sort functions in PHP will work with non-latin1 characters. Make sure setLanguage is called before this.

Definition at line 518 of file ezlocale.php.

## ◆ instance()

static eZLocale::instance | ( |  | $localeString = `false` | ) |
| static

Returns a shared instance of the eZLocale class pr locale string. If $localeString is not specified the default local string in site.ini is used. Use this instead of newing eZLocale to benefit from speed and unified access. note: Use create() if you need to get a new unique copy you can alter.

Parameters

  string | false | $localeString |

Returns
  eZLocale

Definition at line 1536 of file ezlocale.php.

Referenced by eZDate\__construct(), eZDateTime\__construct(), eZTime\__construct(), eZCurrency\__construct(), eZContentLanguage\addLanguage(), eZGeneralDigestHandler\attribute(), eZTemplateCompiler\compilationFilename(), currentLocaleCode(), eZFloatType\fetchClassAttributeHTTPInput(), eZOrder\fetchLocaleCurrencyCode(), eZFloatType\fetchObjectAttributeHTTPInput(), eZPriceType\fetchObjectAttributeHTTPInput(), eZCountryType\fetchTranslatedNames(), eZFloatType\fixupClassAttributeHTTPInput(), eZRSSExport\generateFeed(), eZSubTreeHandler\handlePublishEvent(), eZi18nOperator\i18nTrans(), eZTemplateLocaleOperator\l10nTransformation(), eZContentObjectTranslation\locale(), localeList(), eZContentLanguage\localeObject(), eZDateOperatorCollection\modify(), eZTemplateLocaleOperator\modify(), eZTemplateUnitOperator\modify(), eZTemplateUnitOperator\operatorTransform(), eZDiscountSubRule\setAttribute(), eZDateType\title(), eZDateTimeType\title(), eZTimeType\title(), ezpI18n\translateText(), eZContentObjectVersion\unserialize(), eZFloatType\validateClassAttributeHTTPInput(), eZFloatType\validateObjectAttributeHTTPInput(), and eZPriceType\validateObjectAttributeHTTPInput().

## ◆ internalCurrency()

eZLocale::internalCurrency | ( |  | $number | ) |

Formats the currency according locale to the representation used internally in PHP

Definition at line 1212 of file ezlocale.php.

## ◆ internalNumber()

eZLocale::internalNumber | ( |  | $number | ) |

Formats the number according locale to the representation used internally in PHP

Definition at line 1156 of file ezlocale.php.

## ◆ internationalLanguageName()

eZLocale::internationalLanguageName | ( |  | ) |

Returns the name of the language in English (eng).

Definition at line 728 of file ezlocale.php.

References $IntlLanguageName.

## ◆ isDebugEnabled()

static eZLocale::isDebugEnabled | ( |  | ) |
| static

Returns
  true if debugging of internals is enabled, this will display which files are loaded and when cache files are created. Set the option with setIsDebugEnabled().

Definition at line 1586 of file ezlocale.php.

References DEBUG_INTERNALS.

Referenced by countryFile(), languageFile(), and localeFile().

## ◆ isMondayFirst()

eZLocale::isMondayFirst | ( |  | ) |

Returns true if the week starts with monday, false if sunday.

See also
  weekDays()

Definition at line 761 of file ezlocale.php.

References $MondayFirst.

## ◆ isValid()

eZLocale::isValid | ( |  | ) |

Returns
  true if the locale is valid, ie the locale file could be loaded.

Definition at line 317 of file ezlocale.php.

References $IsValid.

## ◆ languageCode()

eZLocale::languageCode | ( |  | ) |

Returns the language code for this language, for instance nor for norwegian or eng for english.

Definition at line 649 of file ezlocale.php.

References $LanguageCode.

Referenced by languageFile(), and localeFile().

## ◆ languageComment()

eZLocale::languageComment | ( |  | ) |

Returns the comment for the language, if any.

Definition at line 657 of file ezlocale.php.

References $LanguageComment.

## ◆ languageFile()

eZLocale::languageFile | ( |  | $withVariation = `false` | ) |

Returns the eZINI object for the language ini file.

Warning
  Do not modify this object.

Definition at line 1503 of file ezlocale.php.

References countryVariation(), isDebugEnabled(), languageCode(), and eZDebug\writeNotice().

Referenced by __construct().

## ◆ languageList()

static eZLocale::languageList | ( |  | $withVariations = `true` | ) |
| static

Returns
  a list of languages which was found in the system, the languages are in identifier form, for instance: nor, eng

Parameters

  $withVariations | If `true` it will include variations of locales (ends with @identifier)

Definition at line 1417 of file ezlocale.php.

References localeRegexp().

## ◆ languageName()

eZLocale::languageName | ( |  | ) |

Returns the name of the language in its own tounge.

Definition at line 720 of file ezlocale.php.

References $LanguageName.

## ◆ localeCode()

eZLocale::localeCode | ( |  | ) |

Returns the locale code for this language which is the language and the country with a dash (-) between them, for instance nor-NO or eng-GB.

Definition at line 666 of file ezlocale.php.

References $LocaleCode.

Referenced by httpLocaleCode().

## ◆ localeFile()

eZLocale::localeFile | ( |  | $withVariation = `false` | ) |

Returns the eZINI object for the locale ini file.

Warning
  Do not modify this object.

Definition at line 1444 of file ezlocale.php.

References countryCode(), countryVariation(), isDebugEnabled(), languageCode(), and eZDebug\writeNotice().

Referenced by __construct().

## ◆ localeFullCode()

eZLocale::localeFullCode | ( |  | ) |

Same as localeCode() but appends the country variation if it is set.

Definition at line 674 of file ezlocale.php.

References $LocaleCode, and countryVariation().

## ◆ localeInformation()

eZLocale::localeInformation | ( |  | $localeString | ) |

Decodes a locale string into language, country and charset and returns an array with the information. Country and charset is optional, country is specified with a - or _ followed by the country code (NO, GB), charset is specified with a . followed by the charset name. Examples of locale strings are: nor-NO, en_GB.utf8, nn_NO

Definition at line 474 of file ezlocale.php.

Referenced by __construct().

## ◆ localeList()

static eZLocale::localeList | ( |  | $asObject = `false`,
|  |  | $withVariations = `true`
| ) |  |
| static

Returns
  a list of locale objects which was found in the system.

Parameters

  $asObject | If `true` it returns each element as an eZLocale object
  $withVariations | If `true` it will include variations of locales (ends with @identifier)

Definition at line 1350 of file ezlocale.php.

References instance(), and localeRegexp().

Referenced by fetchByHttpLocaleCode().

## ◆ localeRegexp()

static eZLocale::localeRegexp | ( |  | $withVariations = `true`,
|  |  | $withCharset = `true`
| ) |  |
| static

Returns
  a regexp which can be used for locale matching. The following groups are defiend
  - 1 - The language identifier
  - 2 - The separator and the country (3)
  - 3 - The country identifier
  - 4 - The separator and the charset (5)
  - 5 - The charset
  - 6 - The separator and the variation (7)
  - 7 - The variation

Note
  The groyps 4 and 5 will only be used if $withCharset is `true`. The groups 6 and 7 will only be used if $withVariations is `true`.

Parameters

  $withVariations | If `true` it will include variations of locales (ends with @identifier)

Definition at line 463 of file ezlocale.php.

Referenced by countryList(), languageList(), and localeList().

## ◆ longDayName()

eZLocale::longDayName | ( |  | $num | ) |

Returns the long name of the day number $num. The different numbers for the days are: Sunday = 0 Monday = 1 Tuesday = 2 Wednesday = 3 Thursday = 4 Friday = 5 Saturday = 6 This functions is usually used together with weekDays().

See also
  shortDayName()

Definition at line 1266 of file ezlocale.php.

Referenced by formatDateTimeType(), and formatDateType().

## ◆ longMonthName()

eZLocale::longMonthName | ( |  | $num | ) |

Returns the long name of the month number $num. The different numbers for the months are: Januray = 1 February = 2 March = 3 April = 4 May = 5 June = 6 July = 7 August = 8 September = 9 October = 10 November = 11 December = 12 This functions is usually used together with months().

See also
  shortMonthName()

Definition at line 1330 of file ezlocale.php.

Referenced by formatDateTimeType(), and formatDateType().

## ◆ meridiemName()

eZLocale::meridiemName | ( |  | $time = `false`,
|  |  | $upcase = `false`
| ) |  |

Returns the name for the meridiem ie am (ante meridiem) or pm (post meridiem). If $time is not supplied or false the current time is used. If $upcase is false the name is in lowercase otherwise uppercase. The time is defined to be am if the hour is less than 12 and pm otherwise. Normally the hours 00 and 12 does not have am/pm attached and are instead called Midnight and Noon, but for simplicity the am/pm is always attached (if the locale allows it).

Definition at line 973 of file ezlocale.php.

References $PM.

Referenced by formatDateTimeType(), and formatTimeType().

## ◆ months()

eZLocale::months | ( |  | ) |

Returns the months of the year as an array. This only supplied for completeness.

See also
  weekDays(), monthsNames()

Definition at line 860 of file ezlocale.php.

References $Months.

## ◆ monthsNames()

eZLocale::monthsNames | ( |  | ) |

Returns the names of months as an array.

See also
  months()

Definition at line 869 of file ezlocale.php.

References $LongMonthNames.

## ◆ negativeSymbol()

eZLocale::negativeSymbol | ( |  | ) |

Returns
  the negative symbol for normal numbers.

Definition at line 793 of file ezlocale.php.

References $NegativeSymbol.

## ◆ positiveSymbol()

eZLocale::positiveSymbol | ( |  | ) |

Returns
  the positive symbol for normal numbers.

Definition at line 801 of file ezlocale.php.

References $PositiveSymbol.

## ◆ reset()

eZLocale::reset | ( |  | ) |
| private

Definition at line 251 of file ezlocale.php.

Referenced by __construct().

## ◆ resetGlobals()

static eZLocale::resetGlobals | ( |  | $localeString = `false` | ) |
| static

Definition at line 1605 of file ezlocale.php.

Referenced by eZTranslatorManager\resetTranslations().

## ◆ setIsDebugEnabled()

static eZLocale::setIsDebugEnabled | ( |  | $debug | ) |
| static

Sets whether internal debugging is enabled or not.

Definition at line 1597 of file ezlocale.php.

## ◆ shortDayName()

eZLocale::shortDayName | ( |  | $num | ) |

Returns the short name of the day number $num. The different numbers for the days are: Sunday = 0 Monday = 1 Tuesday = 2 Wednesday = 3 Thursday = 4 Friday = 5 Saturday = 6 This functions is usually used together with weekDays().

See also
  longDayName()

Definition at line 1239 of file ezlocale.php.

Referenced by formatDateTimeType(), and formatDateType().

## ◆ shortMonthName()

eZLocale::shortMonthName | ( |  | $num | ) |

Returns the short name of the month number $num. The different numbers for the months are: Januray = 1 February = 2 March = 3 April = 4 May = 5 June = 6 July = 7 August = 8 September = 9 October = 10 November = 11 December = 12 This functions is usually used together with months().

See also
  longMonthName()

Definition at line 1298 of file ezlocale.php.

Referenced by formatDateTimeType(), and formatDateType().

## ◆ thousandsSeparator()

eZLocale::thousandsSeparator | ( |  | ) |

Returns
  the thousand separator for normal numbers.

Definition at line 777 of file ezlocale.php.

References $ThousandsSeparator.

## ◆ transformToPHPFormat()

static eZLocale::transformToPHPFormat | ( |  | $fmt,
|  |  | $allowed
| ) |  |
| static private

Transforms the date/time string $fmt into a string that can be passed to the PHP function 'date'.

Parameters

  $fmt | An eZ Publish locale format, x means a 'formatting character' from PHPs 'date' function.
  $allowed | An array with characters that are considered allowed 'formatting characters' Any character not found in this array will be kept intact by escaping it.

See also
  http://www.php.net/manual/en/function.date.php

Definition at line 1085 of file ezlocale.php.

Referenced by formatDateTimeType(), formatDateType(), and formatTimeType().

## ◆ translatedCountryNames()

eZLocale::translatedCountryNames | ( |  | ) |

Definition at line 1204 of file ezlocale.php.

References $CountryNames.

## ◆ weekDayNames()

eZLocale::weekDayNames | ( |  | $short = `false` | ) |

Returns the same array as in weekDays() but with all days translated to text.

Definition at line 877 of file ezlocale.php.

References $LongWeekDayNames, and $ShortWeekDayNames.

Referenced by weekDayShortNames().

## ◆ weekDays()

eZLocale::weekDays | ( |  | ) |

Returns an array with the days of the week according to locale information. Each entry in the array can be supplied to the shortDayName() and longDayName() functions.

See also
  isMondayFirst(), weekDayNames()

Definition at line 851 of file ezlocale.php.

References $WeekDays.

## ◆ weekDayShortNames()

eZLocale::weekDayShortNames | ( |  | ) |

Returns the same array as in weekDayNames() but with short version of days.

Definition at line 895 of file ezlocale.php.

References weekDayNames().

## Member Data Documentation

## ◆ $AllowedCharsets

eZLocale::$AllowedCharsets

Definition at line 1687 of file ezlocale.php.

Referenced by allowedCharsets().

## ◆ $AM

eZLocale::$AM

AM and PM names.

Definition at line 1636 of file ezlocale.php.

## ◆ $Charset

eZLocale::$Charset

Definition at line 1681 of file ezlocale.php.

Referenced by charset().

## ◆ $Country

eZLocale::$Country

Objects.

Definition at line 1697 of file ezlocale.php.

Referenced by countryName().

## ◆ $CountryCode

eZLocale::$CountryCode

Definition at line 1698 of file ezlocale.php.

Referenced by countryCode().

## ◆ $CountryComment

eZLocale::$CountryComment

Definition at line 1700 of file ezlocale.php.

Referenced by countryComment().

## ◆ $CountryINI

eZLocale::$CountryINI

Definition at line 1703 of file ezlocale.php.

## ◆ $CountryNames

eZLocale::$CountryNames

Definition at line 1711 of file ezlocale.php.

Referenced by translatedCountryNames().

## ◆ $CountryVariation

eZLocale::$CountryVariation

Definition at line 1699 of file ezlocale.php.

Referenced by countryVariation().

## ◆ $CurrencyDecimalSymbol

eZLocale::$CurrencyDecimalSymbol

Currency.

Definition at line 1650 of file ezlocale.php.

Referenced by currencyDecimalSymbol().

## ◆ $CurrencyFractDigits

eZLocale::$CurrencyFractDigits

Definition at line 1652 of file ezlocale.php.

Referenced by currencyDecimalCount().

## ◆ $CurrencyName

eZLocale::$CurrencyName

Definition at line 1685 of file ezlocale.php.

Referenced by currencyName().

## ◆ $CurrencyNegativeFormat

eZLocale::$CurrencyNegativeFormat

Definition at line 1657 of file ezlocale.php.

## ◆ $CurrencyNegativeSymbol

eZLocale::$CurrencyNegativeSymbol

Definition at line 1653 of file ezlocale.php.

Referenced by currencyNegativeSymbol().

## ◆ $CurrencyPositiveFormat

eZLocale::$CurrencyPositiveFormat

Definition at line 1656 of file ezlocale.php.

## ◆ $CurrencyPositiveSymbol

eZLocale::$CurrencyPositiveSymbol

Definition at line 1654 of file ezlocale.php.

Referenced by currencyPositiveSymbol().

## ◆ $CurrencyShortName

eZLocale::$CurrencyShortName

Definition at line 1686 of file ezlocale.php.

Referenced by currencyShortName().

## ◆ $CurrencySymbol

eZLocale::$CurrencySymbol

Definition at line 1655 of file ezlocale.php.

Referenced by currencySymbol().

## ◆ $CurrencyThousandsSeparator

eZLocale::$CurrencyThousandsSeparator

Definition at line 1651 of file ezlocale.php.

Referenced by currencyThousandsSeparator().

## ◆ $DateArray

eZLocale::$DateArray

Definition at line 1670 of file ezlocale.php.

## ◆ $DateFormat

eZLocale::$DateFormat

Format of dates.

Definition at line 1626 of file ezlocale.php.

## ◆ $DatePHPArray

eZLocale::$DatePHPArray

Definition at line 1689 of file ezlocale.php.

## ◆ $DateSlashInputArray

eZLocale::$DateSlashInputArray

Definition at line 1688 of file ezlocale.php.

## ◆ $DateSlashOutputArray

eZLocale::$DateSlashOutputArray

Definition at line 1675 of file ezlocale.php.

## ◆ $DateTimeArray

eZLocale::$DateTimeArray

Definition at line 1690 of file ezlocale.php.

## ◆ $DateTimeFormat

eZLocale::$DateTimeFormat

Definition at line 1683 of file ezlocale.php.

## ◆ $DateTimePHPArray

eZLocale::$DateTimePHPArray

Definition at line 1691 of file ezlocale.php.

## ◆ $DateTimeSlashInputArray

eZLocale::$DateTimeSlashInputArray

Definition at line 1674 of file ezlocale.php.

## ◆ $DateTimeSlashOutputArray

eZLocale::$DateTimeSlashOutputArray

Definition at line 1676 of file ezlocale.php.

## ◆ $DayNames

eZLocale::$DayNames

Help arrays.

Definition at line 1662 of file ezlocale.php.

## ◆ $DecimalSymbol

eZLocale::$DecimalSymbol

Numbers.

Definition at line 1641 of file ezlocale.php.

Referenced by decimalSymbol().

## ◆ $FractDigits

eZLocale::$FractDigits

Definition at line 1643 of file ezlocale.php.

Referenced by decimalCount().

## ◆ $functionMap

eZLocale::$functionMap

Definition at line 1678 of file ezlocale.php.

## ◆ $HTTPLocaleCode

eZLocale::$HTTPLocaleCode

Definition at line 1677 of file ezlocale.php.

Referenced by httpLocaleCode().

## ◆ $IntlLanguageName

eZLocale::$IntlLanguageName

Internationalized name of the language.

Definition at line 1710 of file ezlocale.php.

Referenced by internationalLanguageName().

## ◆ $IsValid

eZLocale::$IsValid

Definition at line 1621 of file ezlocale.php.

Referenced by isValid().

## ◆ $Language

eZLocale::$Language

Definition at line 112 of file ezlocale.php.

## ◆ $LanguageCode

eZLocale::$LanguageCode

The language code, for instance nor-NO, or eng-GB.

Definition at line 1706 of file ezlocale.php.

Referenced by languageCode().

## ◆ $LanguageComment

eZLocale::$LanguageComment

Definition at line 1701 of file ezlocale.php.

Referenced by languageComment().

## ◆ $LanguageINI

eZLocale::$LanguageINI

Definition at line 1704 of file ezlocale.php.

## ◆ $LanguageName

eZLocale::$LanguageName

Name of the language.

Definition at line 1708 of file ezlocale.php.

Referenced by languageName().

## ◆ $LocaleCode

eZLocale::$LocaleCode

Definition at line 1679 of file ezlocale.php.

Referenced by localeCode(), and localeFullCode().

## ◆ $LocaleINI

eZLocale::$LocaleINI

Definition at line 1702 of file ezlocale.php.

## ◆ $LongDayNames

eZLocale::$LongDayNames

Definition at line 1663 of file ezlocale.php.

## ◆ $LongMonthNames

eZLocale::$LongMonthNames

Definition at line 1665 of file ezlocale.php.

Referenced by monthsNames().

## ◆ $LongWeekDayNames

eZLocale::$LongWeekDayNames

Definition at line 1667 of file ezlocale.php.

Referenced by weekDayNames().

## ◆ $MondayFirst

eZLocale::$MondayFirst

True if monday is the first day of the week.

Definition at line 1634 of file ezlocale.php.

Referenced by isMondayFirst().

## ◆ $MonthNames

eZLocale::$MonthNames

Definition at line 1664 of file ezlocale.php.

## ◆ $Months

eZLocale::$Months

Definition at line 1666 of file ezlocale.php.

Referenced by months().

## ◆ $NegativeSymbol

eZLocale::$NegativeSymbol

Definition at line 1644 of file ezlocale.php.

Referenced by negativeSymbol().

## ◆ $OverrideCharset

eZLocale::$OverrideCharset

Definition at line 1682 of file ezlocale.php.

## ◆ $PM

eZLocale::$PM

Definition at line 1636 of file ezlocale.php.

Referenced by meridiemName().

## ◆ $PositiveSymbol

eZLocale::$PositiveSymbol

Definition at line 1645 of file ezlocale.php.

Referenced by positiveSymbol().

## ◆ $ShortDateFormat

eZLocale::$ShortDateFormat

Format of short dates.

Definition at line 1628 of file ezlocale.php.

## ◆ $ShortDateTimeFormat

eZLocale::$ShortDateTimeFormat

Definition at line 1684 of file ezlocale.php.

## ◆ $ShortDayNames

eZLocale::$ShortDayNames

Definition at line 1663 of file ezlocale.php.

## ◆ $ShortMonthNames

eZLocale::$ShortMonthNames

Definition at line 1665 of file ezlocale.php.

## ◆ $ShortTimeFormat

eZLocale::$ShortTimeFormat

Format of short times.

Definition at line 1632 of file ezlocale.php.

## ◆ $ShortWeekDayNames

eZLocale::$ShortWeekDayNames

Definition at line 1667 of file ezlocale.php.

Referenced by weekDayNames().

## ◆ $ThousandsSeparator

eZLocale::$ThousandsSeparator

Definition at line 1642 of file ezlocale.php.

Referenced by thousandsSeparator().

## ◆ $TimeArray

eZLocale::$TimeArray

Definition at line 1669 of file ezlocale.php.

## ◆ $TimeFormat

eZLocale::$TimeFormat

Format of times.

Definition at line 1630 of file ezlocale.php.

## ◆ $TimePHPArray

eZLocale::$TimePHPArray

Definition at line 1671 of file ezlocale.php.

## ◆ $TimeSlashInputArray

eZLocale::$TimeSlashInputArray

Definition at line 1672 of file ezlocale.php.

## ◆ $TimeSlashOutputArray

eZLocale::$TimeSlashOutputArray

Definition at line 1673 of file ezlocale.php.

## ◆ $TranslationCode

eZLocale::$TranslationCode

Definition at line 1680 of file ezlocale.php.

## ◆ $WeekDays

eZLocale::$WeekDays

Definition at line 1666 of file ezlocale.php.

Referenced by weekDays().

## ◆ DEBUG_INTERNALS

const eZLocale::DEBUG_INTERNALS = false

Definition at line 113 of file ezlocale.php.

Referenced by isDebugEnabled().

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+.