S
S
Svetlana Galenko2019-10-13 21:35:32
Yii
Svetlana Galenko, 2019-10-13 21:35:32

Error 500 after adding multi-language package to skeeks cms?

Hello, after adding the skeeks/cms-multi-language package to the site, I open the site, and there is an error "An internal server error occurred".
I found a file in vendor/skeeks/cms-multi-language/src/widgets/views/langs-list.php where this error lies.
The problem is in this code, but I can't figure out what the problem is:

<? foreach (\Yii::$app->multiLanguage->cmsLangs as $cmsLang) : ?>
    <?
    $name = \skeeks\cms\helpers\StringHelper::ucfirst( $cmsLang->name ); //Испходное название языка
    $currentName = \skeeks\cms\helpers\StringHelper::ucfirst( \Yii::t('skeeks/multi-lang/langs', $cmsLang->name)); //Переведенное на текущий язык
    $myLangName = $currentName;
    if (\Yii::$app->language != \Yii::$app->multiLanguage->default_lang) {
        $myLangName = \skeeks\cms\helpers\StringHelper::ucfirst( \Yii::t('skeeks/multi-lang/langs', $cmsLang->name, [], \Yii::$app->multiLanguage->default_lang)); //Переведенное на моя желаемый язык
    }
    $title = $currentName;
    if ($myLangName != $currentName) {
        $title .= " [{$myLangName}]";
    }
    ?>
        <?
        $urlData = [];
        $params = \Yii::$app->request->getQueryParams();
        if ($params) {
            $params = \yii\helpers\ArrayHelper::merge($params, ['lang' => $cmsLang->code]);
        } else {
            $params = \yii\helpers\ArrayHelper::merge([], ['lang' => $cmsLang->code]);
        }
        $route = \Yii::$app->requestedRoute;
        $urlData = ["/".$route];
        $urlData = \yii\helpers\ArrayHelper::merge($urlData, $params);
        ?>
        <a href="<?= \yii\helpers\Url::to($urlData) ?>" title="<?= $title; ?>">
            <img src="<?= $cmsLang->image ? $cmsLang->image->src : \skeeks\cms\helpers\Image::getCapSrc(); ?>" style="margin-top: 25px;margin-left: 10px; margin-bottom: 10px;" alt="<?= $cmsLang->code; ?>"/>
        </a>
<? endforeach; ?>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question