Answer the question
In order to leave comments, you need to log in
How to overcome error in MODx Could not set the locale?
How to get rid of the error
Could not set the locale. Please check if the locale ru_RU.UTF-8 exists on your system
Answer the question
In order to leave comments, you need to log in
I looked at my sites - those that are on a regular shared hosting - everything is normal there. Those who are on the VPS are also pouring in there. Reason for the error and solution:
On the server, the locale was en_US.UTF-8 UTF-8
Registered locale en_US.UTF-8 in the modx settings and the error went away
To use ru_RU.UTF-8
Generated two locales on the
[email protected] server: ~# cat /etc/locale.gen | grep -v '#'
en_US.UTF-8 UTF-8
ru_RU.UTF-8 UTF-8
At the same time, I set the Cyrillic locale as the main one, and everything is buzzing.
you can check it like this
[email protected]:~# echo $LANG
If without reconfiguring the server, then set the en_US.UTF-8 locale, and to display dates in Russian, use the snippet:
The dateRU snippet code itself:
<?php
$month_arr = array(
'01' => 'Января',
'02' => 'Февраля',
'03' => 'Марта',
'04' => 'Апреля',
'05' => 'Мая',
'06' => 'Июня',
'07' => 'Июля',
'08' => 'Августа',
'09' => 'Сентября',
'10' => 'Октября',
'11' => 'Ноября',
'12' => 'Декабря'
);
$d = $input;
$month = strftime("%m",$d);
$year = strftime("%Y",$d);
$day = strftime("%d",$d);
$month = $month_arr[$month];
return "$day $month $year";
?>
<?php
setlocale(LC_ALL, "ru_RU.UTF-8");
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question