public function locale()
    {
        $accept_language = $this->getHeader('accept_language');

        $tmp = explode(';', $accept_language)[0];

        preg_match('/^([a-z]+(?:-|_)?[a-z]+)/i', $tmp, $match);

        return end($match);
    }
public function locale()
    {
        $accept_language = $this->getHeader('accept_language');

        $tmp = explode(';', $accept_language)[0];

        preg_match('/^([a-z]+(?:-|_)?[a-z]+)/i', $tmp, $match);

        return end($match);
    }
public function locale ( ) { $ accept_language = $ this -> getHeader ( 'accept_language' ) ; $ tmp = explode ( ';' , $ accept_language ) [ 0 ] ; preg_match ( '/^([a-z]+(?:-|_)?[a-z]+)/i' , $ tmp , $ match ) ; return end ( $ match ) ; }
Get the request locale.

The local is the original language of the client
e.g fr => locale = fr_FR
e.g en => locale [ en_US, en_EN]

@return string|null
Get the request locale .