B
B
boodda2016-07-25 14:42:57
PHP
boodda, 2016-07-25 14:42:57

Locale does not change in PHP 7 on Debian 8. What should I do?

Debian 8 installed. PHP 7.0.1 installed
locale -a

C
C.UTF-8
POSIX
en_GB
en_GB.iso88591
en_GB.iso885915
en_GB.utf8
en_US
en_US.iso88591
en_US.iso885915
en_US.utf8
ru_RU
ru_RU.cp1251
ru_RU.iso88595
ru_RU.koi8r
ru_RU.utf8
russian

launching
php -r "var_dump(setlocale(LC_ALL, 'ru_RU'));var_dump(date('Y M'));"
php -r "var_dump(setlocale(LC_ALL, 'ru_RU.utf8'));var_dump(date('Y M'));"
php -r "var_dump(setlocale(LC_ALL, 'ru_RU.cp1251'));var_dump(date('Y M'));"
php -r "var_dump(setlocale(LC_ALL, 'russian'));var_dump(date('Y M'));"
php -r "var_dump(setlocale(LC_TIME, 'ru_RU'));var_dump(date('Y M'));"
php -r "var_dump(setlocale(LC_TIME, 'ru_RU.utf8'));var_dump(date('Y M'));"
php -r "var_dump(setlocale(LC_TIME, 'ru_RU.cp1251'));var_dump(date('Y M'));"
php -r "var_dump(setlocale(LC_TIME, 'russian'));var_dump(date('Y M'));"

All variants return
string(8) "2016 Jul"
The setlocale function itself returns the name of the locale, that is, it works. But why is the date not internationalized?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
BoShurik, 2016-07-25
@boodda

datelocale independent
You need IntlDateFormatter or strftime

B
boodda, 2016-07-25
@boodda

Well, exactly!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question