Answer the question
In order to leave comments, you need to log in
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'
],
<?=Yii::$app->formatter->asDatetime($page->created_at)?>
17 July, 11:13
Answer the question
In order to leave comments, you need to log in
If my memory serves me, I need to add something in the php.ini configuration.
extension=php_intl.dll
www.yiiframework.com/doc-2.0/guide-output-formatte... Line
18
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 questionAsk a Question
731 491 924 answers to any question