LC_MESSAGES, windows 7 / 10, Locale, Symfony2.8
Closed this issue · 12 comments
I'm stuck on that:
Notice: Use of undefined constant LC_MESSAGES - assumed 'LC_MESSAGES' in C:\xampp\htdocs\symfony2_8project\vendor\leaseweb\gettext-translation-bundle\Lsw\GettextTranslationBundle\Routing\GettextLocaleListener.php on line 56
Warning: setlocale(): Invalid locale category name LC_MESSAGES, must be one of LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME in C:\xampp\htdocs\symfony2_8project\vendor\leaseweb\gettext-translation-bundle\Lsw\GettextTranslationBundle\Routing\GettextLocaleListener.php on line 56
Fatal error: Uncaught exception 'Symfony\Component\Routing\Exception\InvalidParameterException' with message 'Requested locale 'en_US' could not be set.
Is this locale installed? Hint: Execute 'locale -a' on the Linux command line to list installed locales.'
in C:\xampp\htdocs\symfony2_8project\vendor\leaseweb\gettext-translation-bundle\Lsw\GettextTranslationBundle\Routing\GettextLocaleListener.php:58
Stack trace:
#0 [internal function]: Lsw\GettextTranslationBundle\Routing\GettextLocaleListener->onKernelRequest(Object(Symfony\Component\HttpKernel\Event\GetResponseEvent), 'kernel.request', Object(Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher))
#1 C:\xampp\htdocs\symfony2_8project\vendor\symfony\symfony\src\Symfony\Component\EventDispatcher\EventDispatcher.php(181): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\GetResponseEvent), 'kernel.request', Object(Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher))
#2 C:\xampp\htdocs\symfony_projec in C:\xampp\htdocs\symfony2_8project\vendor\leaseweb\gettext-translation-bundle\Lsw\GettextTranslationBundle\Routing\GettextLocaleListener.php on line 58
- Windows 7 or 10 : the problem is the same
- Xampp with PHP 5.6
- Symfony2.8
- http://php.net/manual/en/function.setlocale.php
I'm not sure about that:- LC_MESSAGES for system responses (available if PHP was compiled with libintl)
Please try to uncomment "extension=php_intl.dll" in "php.ini" and report back what changed.
Unfortunately there is no differences with uncommenting the php_intl.dl file. The error is the same.
Did you restart Apache?
Yes, Of course. But I think it is a problem of how my PHP was compiled. I'm trying to find some solution based on this theory.
AFAIK Symfony checks environment dependencies during setup and "intl" is one of them. Did you skip that step? Can you start a new Symfony project and check?
Mhm, I see. Ok, I will follow your suggestions and come back with the result.
The Error is still existing. I'm receiving it after Step 2: Enable the bundle of Installation process.
After reading: http://symfony.com/doc/current/components/intl.html
It seems to me that install "intl" is not mandatory (or mandatory anymore).
Can you run phpinfo and verify intl is enabled, see: http://grokbase.com/t/php/php-windows/13cer8rnj4/phpinfo-not-finding-intl-and-mbstring
For installation instructions also check: http://php.net/manual/en/intl.installation.php
PHPinfo show me that I have all of them installed and enabled:
- intl / mbstring / gettext
I installed intl through composer, too.
I used this: http://symfony.com/doc/2.8/components/intl.html
The problem still exists.
If you installed "intl", then the "Notice" and "Warning" should be gone. The "Fatal" may be solved by spelling the locale in the way the system supports it. On windows 7 it seems to be "en-US" not "en_US". Set this in "Resources/config/config.yml". Maybe that will solve your problem.
Ok, "Notice" and "Warning" are solved by changing "LC_MESSAGES" to "LC_ALL" into:
GettextLocaleListener.php
No difference for how the locale is going to be set in config.yml. I've tried them all: "en-US", "en_US", "en", clearing the cache, by the console.
Maybe you can try a few steps from this bug report to see how your environment behaves: