Tag: I18N
-
Post Views: 17 1. Error in Yii 2.0: ExceptionYii\Base\InvalidConfigExceptionwith messageUnable to local message source for categoryError.. as shown in Figure 1 2. Edit ccp/config/console.php, add components: i18n 3. Run the command line again, and report an error: ExceptionYii\Web\NotFoundHttpExceptionwith message205064. as shown in Figure 2 4. Create a new directory, /ccp/messages. The contents of the file /ccp/messages/en-cn/error.php are as follows. as…
-
Post Views: 13 1. The configuration code of the I18N application components is as follows: 2. Request the interface in Postman, in headers, accept-language:zh-cn, when the target language is Simplified Chinese, and the category name of the file is: success, it is mapped to the php file @app/messages/zh-cn/success.php, as shown in Figure 1 3. Request the interface in Postman, in…
-
Post Views: 16 1. The previous implementation is as follows, the configuration file in the public directory, \common\config\main.php, the international configuration is as follows: 2. The files in the message directory (messages) in the public directory are as follows: \common\messages\zh-cn\error.php \common\messages\zh-cn\error.php 3. The files in the message directory (Messages) in the interface application are as follows: \API\Messages\zh-cn\Error.php \API\Messages\zh-cn\success.php 4. The…
-
Post Views: 71 1. RESTful web service, it is recommended to implement based on a separate interface application, at this time, it is implemented based on the API application 2. Create a new directory: \api\rests, this directory will be used as the operation method category directory of the RESTful web service 3. Create a new controller class \API\Controllers\UserController.php , and…
-
Post Views: 14 1. Because some public models are generated into the common directory, and multiple database connection components are configured, for KCU The models of the CDB are prefixed with kcuc to prevent naming conflicts (otherwise, the model name is not recommended with the corresponding table prefix), as shown in Figure 1: 2. Use table prefix: use the table…