13th August 2009 - 6 minutes read time
Every application has a locale, even if that is just the locale of the author. Through the use of locals you can make your application aware of what sort of language, currency and even timezone that the user would like to see. In Zend Framework this is accoumplished via Zend_Locale.
There are many things to do with locale once, but first you need to determine where the user is based. To find this out you simply create a new instance of the Zend_Locale object. The following code will create the Zend_Locale object and print out the language and region of the user.
$locale = new Zend_Locale();
$language = $locale->getLanguage();
$region = $locale->getRegion();
echo $language . ' ' . $region;
What you see here depends on where you are and what language you are running on your machine. For example, a person living in Germany, who speaks German would see the following output.