I
I
ImPuuLsE2015-07-20 11:12:03
Yii
ImPuuLsE, 2015-07-20 11:12:03

Why is the date not translated into Russian in Yii2?

Hello! there is a common config with the following content:

'timeZone' => 'Europe/Moscow',
    'language'=>'ru-RU',
    'bootstrap' => ['log'],
    'components' => [
        'formatter' => [
            'class' => 'yii\i18n\Formatter',
            'dateFormat' => 'php:d.m.Y',
            'datetimeFormat' => 'php:j F, H:i',
            'timeFormat' => 'php:H:i:s',
            'defaultTimeZone' => 'Europe/Moscow',
            'locale' => 'ru-RU'
        ],

I'm trying to get the date
<?=Yii::$app->formatter->asDatetime($page->created_at)?>

Output:
17 July, 11:13
What am I doing wrong? here is the link to the doc - www.yiiframework.com/doc-2.0/guide-output-formatte...

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
ImPuuLsE, 2015-07-21
@ImPuuLsE

the problem was in the crooked extension from xammp

G
Gregory, 2015-07-20
@sapgv

If my memory serves me, I need to add something in the php.ini configuration.
extension=php_intl.dll

P
Pavel Gogolinsky, 2015-07-20
@gogolinsky

www.yiiframework.com/doc-2.0/guide-output-formatte... Line
18

A
Anton, 2015-07-20
@karminski

Is the default language (sourceLanguage) registered in the config?

return [
    'id' => 'basic',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log', 'lang'],
    'sourceLanguage' => 'en-US',
    'components' => require(__DIR__ . '/components.php'),
    'modules' => require(__DIR__ . '/modules.php'),
    'params' => require(__DIR__ . '/params.php'),
];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question