1. When the Locale value is set to English (US), the editor displays normally when creating an article, but the corresponding language pack file /assets/5fbb6f5a/lang/en.js returns a 404 response, as shown in Figure 1.

2. When the Locale value is set to Simplified Chinese, the editor fails to display normally when creating an article, as shown in Figure 2.

3. Refreshing the page and checking the browser Console reveals that the cause is the missing corresponding language file /assets/5fbb6f5a/lang/zh.js, which in turn leads to Uncaught TypeError: Cannot read property ‘html’ of undefined, as shown in Figure 3.

4. Opening the URL http://backend.yii2-starter-kit.terentev.net/content/article/create shows that the official demo still has this bug, as shown in Figure 4.

5. Checking \backend\views\article\_form.php, the editor code is as follows, which is based on asofter/yii2-imperavi-redactor.
field($model, 'body')->widget(
\yii\imperavi\Widget::className(),
[
'plugins' => ['fullscreen', 'fontcolor', 'video'],
'options' => [
'minHeight' => 400,
'maxHeight' => 400,
'buttonSource' => true,
'convertDivs' => false,
'removeEmptyTags' => false,
'imageUpload' => Yii::$app->urlManager->createUrl(['/file-storage/upload-imperavi'])
]
]
) ?>
7. Open the URL https://imperavi.com/download/redactor/langs/en/ to download en.js, and copy it to \vendor\asofter\yii2-imperavi-redactor\yii\imperavi\assets\lang\en.js to resolve the 404 response for /assets/5fbb6f5a/lang/en.js. Note: If \vendor is not under version control, it is recommended to place en.js under version control so that it is automatically copied to \vendor\asofter\yii2-imperavi-redactor\yii\imperavi\assets\lang\en.js after running composer install. Refresh the page; /assets/5fbb6f5a/lang/en.js now returns a 200 response, as shown in Figure 6.

8. Opening the URL https://imperavi.com/download/redactor/langs/zh/ fails to download. I decided to manually define the editor’s language option based on the current locale to ensure the corresponding language pack file can be found correctly, thereby resolving the editor display issue. Edit \backend\views\article\_form.php.
<?php
/* 基于本地语言环境手动定义编辑器的语言选项 */
switch (Yii::$app->language) {
case 'en-US':
$lang = 'en';
break;
case 'ru-RU':
$lang = 'ru';
break;
case 'uk-UA':
$lang = 'uk';
break;
case 'es':
$lang = 'es';
break;
case 'vi':
$lang = 'vi';
break;
case 'zh-CN':
$lang = 'zh_cn';
break;
case 'pl-PL':
$lang = 'pl';
break;
default:
$lang = 'en';
}
?>
<?php echo $form->field($model, 'body')->widget(
\yii\imperavi\Widget::className(),
[
'plugins' => ['fullscreen', 'fontcolor', 'video'],
'options' => [
'lang' => $lang,
'minHeight' => 400,
'maxHeight' => 400,
'buttonSource' => true,
'convertDivs' => false,
'removeEmptyTags' => false,
'imageUpload' => Yii::$app->urlManager->createUrl(['/file-storage/upload-imperavi'])
]
]
) ?>9. When the Locale value is set to Simplified Chinese, the editor displays normally when creating an article, as shown in Figure 7.

