Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php setlocale arabic strftime

I've run locale -a on my server and can see that it's got Arabic locale settings installed:

  • ar_AE
  • ar_AE.iso88596
  • ar_AE.utf8

However, if I set the locale via:

$locale = array('ar_AE', 'ar_AE.iso88596', 'ar_AE.utf8', 'ar');
setlocale(LC_TIME, $locale);

and output it:

strftime('%A %d %B', $current_date)

The displayed date is in English, not Arabic.

Arabic is the only language this isn't working for: the site I'm working on is in 15 languages and all the others display a translated date.

What's going wrong?

like image 318
Wintermute Avatar asked Apr 23 '12 11:04

Wintermute


1 Answers

This worked for me with no problems at all.

setlocale(LC_ALL, 'ar_AE.utf8');

If this does not work, then there is another code in your PHP file that interferes with the language.

like image 72
syrkull Avatar answered Nov 02 '22 18:11

syrkull