1. Because I am generating some shared models in the common directory and have configured multiple database connection components, all models for kcucDb are prefixed with Kcuc to prevent naming conflicts (otherwise, adding the corresponding table prefix to the model name is not recommended), as shown in Figure 1:

2. Use Table Prefix: Check this to use a table prefix; Generate Labels from DB Comments: Do not check this (because manual translation will be handled later); Enable I18N: Check this to enable internationalization; Message Category: Set the message category to commonAttributeLabels/kcucMembers, which is the category used by Yii::t() for the attribute labels under the current model class when internationalization is enabled. After generation, it looks like Figure 2:

3. Configure the message translation in the application using the following code, as shown in Figure 3:
The pattern commonAttributeLabels* means that all message category names starting with commonAttributeLabels use this translation message source.
The pattern attributeLabels* means that all message category names starting with attributeLabels use this translation message source. Its root path is the current application.
The pattern * specifies the default translation. Its root path is the current application.

4. Create \common\messages\zh-CN\commonAttributeLabels\kcucMembers.php and \common\messages\zh-CN\not_specified_category.php, as shown in Figure 4:

5. Edit \common\messages\zh-CN\commonAttributeLabels\kcucMembers.php, as shown in Figure 5:

6. Tip: For zh-CN, you can first check Generate Labels from DB Comments, copy the public function attributeLabels() from the model class during Preview, and then edit it, as shown in Figure 6;

7. Test,
$model = new \common\models\KcucMembers;
// Displays “Mobile”
echo $model->getAttributeLabel(‘mobile’);
The default [[yii\base\Application::$sourceLanguage|source language]] value is en-US, meaning American English, which remains unchanged. If the [[yii\base\Application::$language|target language]] is not set, or is set to en-US, then
it prints “Mobile”, as shown in Figure 7:
![If the [[yii\base\Application::$language|target language]] is not set, or is set to en-US, then it prints "Mobile"](https://media.shuijingwanwq.com/2016/06/7.png)
it prints “Mobile”
8. The default [[yii\base\Application::$sourceLanguage|source language]] value is en-US, meaning American English, which remains unchanged. If the [[yii\base\Application::$language|target language]] is set to zh-CN, then
it prints “用户手机”, as shown in Figure 8:
![If the [[yii\base\Application::$language|target language]] is set to zh-CN, then it prints "用户手机"](https://media.shuijingwanwq.com/2016/06/8.png)
it prints “用户手机”
