Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notice: Use of undefined constant LC_MESSAGES - assumed 'LC_MESSAGES' #89

Closed
ve3 opened this issue Dec 22, 2015 · 2 comments
Closed

Notice: Use of undefined constant LC_MESSAGES - assumed 'LC_MESSAGES' #89

ve3 opened this issue Dec 22, 2015 · 2 comments

Comments

@ve3
Copy link

ve3 commented Dec 22, 2015

my code:

<?php 

require __DIR__.'/vendor/autoload.php';


setlocale(LC_ALL, 'en-US');

$t = new \Gettext\GettextTranslator();

//Set the language and load the domain
$t->setLanguage('gl');
$t->loadDomain('messages', 'Locale');

And there are errors following...

Deprecated: setlocale(): Passing locale category name as string is deprecated. Use the LC_* -constants instead

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

@oscarotero
Copy link
Member

It seems that LC_MESSAGES is not available. According with the documentation, this constant is available only if PHP was compiled with libintl. So Translator::setLanguage() should check whether the constant exists before use them, and if not, use LC_ALL instead.
Thanks for the report, I'll fix this ASAP.

@oscarotero
Copy link
Member

Released v3.5.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants