Yaf_Request_Abstract::getLanguage

Retrieve the client's preferred language

Description

public stringnull Yaf_Request_Abstract::getLanguage()

Retrieve the client's preferred language

Parameters

This function has no parameters.

Return Values

The preferred language string, or null if it cannot be determined.

Examples

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"

See Also

  • Yaf_Request_Abstract::getServer
  • Yaf_Request_Abstract::getEnv