Answer the question
In order to leave comments, you need to log in
What is the best order to check locales in setlocale?
Right now I'm using the following code to set the locale:
$locale = 'en_US';
if (!setlocale(LC_ALL, $locale.'.UTF-8', $locale.'.utf-8', $locale.'.UTF8', $locale.'.utf8', $locale)) {
$lang = preg_replace('!_.*!', '', $locale);
if (!setlocale(LC_ALL, $lang.'.UTF-8', $lang.'.utf-8', $lang.'.UTF8', $lang.'.utf8', $locale)) {
// Set current locale
setlocale(LC_ALL, '');
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question