Closed polinwei closed 7 years ago
Hi! Check the module configuration Using the users module as an example
Existence of folders https://github.com/Dominus77/yii2-advanced-start/tree/master/modules/users/messages
Connecting Bootstrap.php in the application configuration https://github.com/Dominus77/yii2-advanced-start/blob/9b32ccbb57c3624e00c038609f845c10482fce33/frontend/config/main.php#L17
Connecting the module string https://github.com/Dominus77/yii2-advanced-start/blob/9b32ccbb57c3624e00c038609f845c10482fce33/modules/users/models/User.php#L12
Hi Sir: I did all above steps. In the view: sendtext.php , only outside of ActiveForm like Module::t('module', 'SendCHTMessage'); can work.
View:
Bootstrap
config
frontend
model
module
Model SendtextForm
namespace modules\sms\models;
use modules\sms\Module;
//...
public function attributeLabels()
{
return [
'cellPhoneNo' => Module::t('module', 'cellPhoneNo'), // This lang file in: /modules/sms/messages/zh-TW/module.php
'message' => Yii::t('app', 'Message'), // This lang file in: /frontend/messages/zh-TW/app.php
];
}
//...
Yes , I also did it. It can not show the message: zh-TW\module.php
Hi Sir: I found out the key point . The key word is sensitive. I correct it then can work.
Yes, it should be 1 in 1
/modules/sms/messages/zh-TW/module.php
return [
//...
'cellPhoneNo' => 'This cellPhoneNo',
//...
];
thanks a lot.
$form->field($model, 'cellPhoneNo')->textInput(['class' => 'form-control'])
the wordingcellPhoneNo
can not translate correct.model code