PhpRiot
Follow phpriot on Twitter
Sponsored Link
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store
Free iPad/iPhone App
Available on the App Store

  • PHP manual
  • Zend Framework manual
  • Smarty manual
  • PHP articles
  • PHP training

Default locales

The method getDefault() returns an array of relevant locales using information from the user's web browser (if available), information from the environment of the host server, and Zend Framework settings. As with the constructor for Zend_Locale, the first parameter selects a preference of which information to consider (BROWSER, ENVIRONMENT, or FRAMEWORK first. The second parameter toggles between returning all matching locales or only the first or best match. Locale-aware components normally use only the first locale. A quality rating is included, when available.

Example 534. Get default locales

<?php
$locale 
= new Zend_Locale();

// Return all default locales
$found $locale->getDefault();
print_r($found);

// Return only browser locales
$found2 $locale->getDefault(Zend_Locale::BROWSER,TRUE);
print_r($found2);

To obtain only the default locales relevant to the BROWSER, ENVIRONMENT, or FRAMEWORK, use the corresponding method:

  • getEnvironment()

  • getBrowser()

  • getLocale()

Zend Framework