[英]ZF3 Get browser Language
There are a several of ways to get the browser language in Zend Framework 3. Can anyone tell me what should be the right way ? 在Zend Framework 3中有几种获取浏览器语言的方法。谁能告诉我什么是正确的方法?
I was thinking about getting the locale and substract the language from it ? 我在考虑获取语言环境并从中减去语言吗?
$this->request->getHeader('Accept-Language')->getPrioritized()[0]->getPrimaryTag();
要么
$this->request->getHeader('Accept-Language')->getPrioritized()[0]->getLanguage();
In ZF 2 , somewhere in Controller 在ZF 2中,控制器中的某个位置
$translator = $this->getServiceLocator()->get('translator');
$t = $translator->getLocale();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.