Zend_Locale provides three additional locales. These locales do
not belong to any language or region. They are "automatic" locales which means that they
have the same effect as the method
getDefault() but without the
negative effects like creating an instance. These "automatic" locales can be used
anywhere, where also a standard locale and also the definition of a locale, its string
representation, can be used. This offers simplicity for situations like working with
locales which are provided by a browser.
There are three locales which have a slightly different behaviour:
Zend_Localeshould work with the information which is provided by the user's Web browser. It is published by PHP in the global variable
If a user provides more than one locale within his browser,
Zend_Localewill use the first found locale. If the user does not provide a locale or the script is being called from the command line the automatic locale 'environment' will automatically be used and returned.
Zend_Localeshould work with the information which is provided by the host server. It is published by PHP via the internal function
If a environment provides more than one locale,
Zend_Localewill use the first found locale. If the host does not provide a locale the automatic locale 'browser' will automatically be used and returned.
Zend_Localeshould automatically detect any locale which can be worked with. It will first search for a users locale and then, if not successful, search for the host locale.
If no locale can be detected, it will throw an exception and tell you that the automatic detection has been failed.
Example 540. Using automatic locales
// without automatic detection
//$locale = new Zend_Locale(Zend_Locale::BROWSER);
//$date = new Zend_Date($locale);
// with automatic detection
$date = new Zend_Date('auto');