Determine browser language(s) in Zend Framework?
php, zend-framework
Solution
here you go:
$locale = new Zend_Locale();
// if locale is 'de_AT' then 'de' will be returned as language
print $locale->getLanguage();
// if locale is 'de_AT' then 'AT' will be returned as region
print $locale->getRegion();
Problem
I am dissolving a rather big old library with various PHP helper functions that have amassed over time. I'm looking for Zend Framework based replacements for as many of these functions as possible. My first candidate is a function that returns the users's most preferred browser language from the huge list that can be `http_accept_language`. Does ZF have a function for that? I realize Zend_Translate is able to somehow detect the browser language, but I am not seeing a publicly available function to actually get the language string.