(Yaf >=1.0.0)
Yaf_Request_Abstract::getLanguage — Retrieve the client's preferred language
Retrieve the client's preferred language
This function has no parameters.
The preferred language string, or null if it cannot be determined.
Example #1 Yaf_Request_Abstract::getLanguage() example
<?php
class IndexController extends Yaf_Controller_Abstract
{
public function indexAction()
{
// Assuming the client sends "Accept-Language: zh-CN"
$language = $this->getRequest()->getLanguage();
var_dump($language);
}
}
?>The above example will output something similar to:
string(5) "zh-CN"