Yaf_Request_Abstract::getLanguage
PHP function
Edit on GitHub ✎
(Yaf >=1.0.0)
Retrieve the client's preferred language
Description
Yaf_Request_Abstract::getLanguage(): string|null
Retrieve the client's preferred language
Parameters Parameters
Return Values
The preferred language string, or null if it cannot be determined.
Examples
Yaf_Request_Abstract::getLanguage example
php
<?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:
output
string(5) "zh-CN"See Also
Yaf_Request_Abstract::getServerYaf_Request_Abstract::getEnv