Locale::getDefault()始终返回';en';在服务器上部署的Symfony中


Locale::getDefault() returns always 'en' in Symfony deployed on the server

当我在Symfony2应用程序中调用'Locale::getDefault()时,在服务器上总是得到'en'

开发中的服务器总是可以的。

在任何情况下,$request->getLocale()$request->getDefaultLocale()根据路由返回预期内容,即'fr''en''es'

如何根据我的Request影响应用程序的'Locale

您必须在php.ini中启用intl:intl.default_locale = fr

并为php:sudo apt-get install php7.0-intl

安装intl