📚 Looking for current Exponential documentation? This site contains legacy SDK & API reference docs (eZ Publish era). For up-to-date 2026 product documentation, visit doc.exponential.earth.

  ezlocale / locale  

<< eZ locale™   

Locale settings

The following code reads some locale settings for the nor-NO locale.

include_once( "lib/ezlocale/classes/ezlocale.php" );
$locale =& eZLocale::instance( "nor-NO" );
$infoList = array( 'LanguageCode' => $locale->languageCode(),
                   'Language' => $locale->languageName(),
                   'LanguageComment' => $locale->languageComment(),
                   'Content-Language' => $locale->httpLocaleCode(),
                   'CountryCode' => $locale->countryCode(),
                   'CountryVariation' => $locale->countryVariation(),
                   'Country' => $locale->countryName(),
                   'CountryComment' => $locale->countryComment(),
                   'Time' => $locale->formatTime(),
                   'ShortTime' => $locale->formatShortTime(),
                   'Date' => $locale->formatDate(),
                   'ShortDate' => $locale->formatShortDate(),
                   'DateTime' => $locale->formatDateTime(),
                   'ShortDateTime' => $locale->formatShortDateTime(),
                   'MondayFirst' => ( $locale->isMondayFirst() ? "Yes" : "No" ),
                   'Number' => ( $locale->formatNumber( 1234567.89 ) . " / " . $locale->formatNumber( -1234567.89 ) ),
                   'Currency' => ( $locale->formatCurrency( 123456789.00 ) . " / " . $locale->formatCurrency( -123456789.00 ) ) );

print( "<table><tr><th>Type</th><th>Result</th></tr>
<tr><td colspan="2"><b>Locale</b></td></tr>" );
foreach( $infoList as $infoName => $infoText )
{
    print( "<tr><td>$infoName</td><td>$infoText</td></tr>\n" );
}
print( "</table>" );

This will produce something like this:

TypeResult
Locale
LanguageCodenor
LanguageNorsk (Bokm�l)
LanguageComment
Content-Languageno-bokmaal
CountryCodeNO
CountryVariation
CountryNorway
CountryComment
Time16:11:24
ShortTime16:11
Date07. februar 2003
ShortDate07.02.2003
DateTime07. februar 2003 16:11:24
ShortDateTime07.02.2003 16:11
MondayFirstYes
Number1.234.567,89 / -1.234.567,89
Currencykr 123.456.789,00 / kr -123.456.789,00

Exponential Copyright © 1998 - 2026 7x