R
R
Ruslan Saiko2016-02-22 02:52:30
Yii
Ruslan Saiko, 2016-02-22 02:52:30

How to organize multilingualism in Yii2 with SEO optimized links?

Good day to all.
I organize multilingualism according to this article Yii2 and the organization of multilingualism , everything is ok on the frontend, but the trouble is with the backend.
The essence of the problem is this... When I go to the admin panel using the link 'kamikaze/admin', I get this error
e8455c6767bf4cef872167b5e9ef013e.png
. I don't know what to do anymore.
Here is the config file from the backend

...
 'urlManager' => [
           'class' => 'backend\components\localization\LocalizationUrlManager',
            'baseUrl' => '/admin',
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
                '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
            ],

        ],
        'request' => [
            'class' => 'backend\components\localization\LocalizationRequest',
            'baseUrl' => '/admin',
        ],
...

I would be very grateful for the help) I
forgot to add. It is important to write everything yourself

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill Arutyunov, 2016-02-22
@RuslanSaiko

Here is what I used for multilingual Yii2 sites:

"codemix/yii2-localeurls": "*",
"zelenin/yii2-i18n-module": "dev-master",
"omgdef/yii2-multilingual-behavior": "~2.0"

The first package generates a URL depending on the language. You can set the default language.
You can set exceptions for certain URLs that do not need to be redirected to the language version. For example, this is true for /api.
The second package puts all language phrases into the database and creates a separate /translations URL through which untranslated phrases can be translated.
The third package allows you to create a model with translation on the fly, so that data in the desired language is pulled up for the model. For example, you have an article in 2 languages, and this extension itself determines which language is selected for the user and which language version of the article is displayed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question