1. When requesting the WeChat API, the return code is 45028, and the returned English message is: has no masssend quota rid: 6103df2e-1505ba73-0eb14e1c. See Figure 1.

{
"errcode": 45028,
"errmsg": "has no masssend quota rid: 6103df2e-1505ba73-0eb14e1c"
}
2. The code implementation is as follows.
$responseData = $wxServiceApi::wxMessageSendAll($requestData);
if (!isset($responseData['msg_id'])) {
$errcode = array_key_exists('errcode',$responseData)?$responseData['errcode']:205100;
throw new ServerErrorHttpException(Yii::t('error', Yii::t('error', Yii::t('error', '205100'), ['error_code' => $errcode, 'error_msg' => $responseData['errmsg']])), 205100);
}
3. I plan to translate the error message: has no masssend quota rid: 6103df2e-1505ba73-0eb14e1c to: 没有群发配额。rid: 6103df2e-1505ba73-0eb14e1c. See Figure 2.

4. Add the files common/messages/en-US/wx.php, common/messages/zh-CN/wx.php, wx/messages/en-US/wx.php, and wx/messages/zh-CN/wx.php. See Figure 3.

common/messages/en-US/wx.php
<?php
return [
];common/messages/zh-CN/wx.php
<?php
return [
'has no masssend quota' => '没有群发配额(订阅号为每天 1 次,服务号为每月 4 次)。',
'invalid content' => '无效内容(内容中包含音频)。',
];wx/messages/en-US/wx.php
<?php
$commonMessages = require __DIR__ . '/../../../common/messages/en-US/wx.php';
$messages = [
];
return $commonMessages + $messages;wx/messages/zh-CN/wx.php
<?php
$commonMessages = require __DIR__ . '/../../../common/messages/zh-CN/wx.php';
$messages = [
];
return $commonMessages + $messages;5. The code implementation is as follows. The result of the code: substr($responseData[‘errmsg’], 0, $pos) is: has no masssend quota. The result of the code: substr($responseData[‘errmsg’], $pos) is: rid: 6103df2e-1505ba73-0eb14e1c. After translating “has no masssend quota” to “没有群发配额。”, it is then concatenated with: rid: 6103df2e-1505ba73-0eb14e1c.
$responseData = $wxServiceApi::wxMessageSendAll($requestData);
if (!isset($responseData['msg_id'])) {
$errcode = $responseData['errcode'] ?? 205100;
$pos = strpos($responseData['errmsg'], ' rid:');
$errorMsg = Yii::t('wx', substr($responseData['errmsg'], 0, $pos)) . substr($responseData['errmsg'], $pos);
throw new ServerErrorHttpException(Yii::t('error', Yii::t('error', Yii::t('error', '205100'), ['error_code' => $errcode, 'error_msg' => $errorMsg])), 205100);
}
6. For the returned English message: invalid content hint: [pzRHda0286d228] rid: 61041ffe-5cefd269-6c9611ff, the improved code is as follows. The root cause is that the source language messages do not support fuzzy matching.
$responseData = $wxServiceApi::wxMessageSendAll($requestData);
if (!isset($responseData['msg_id'])) {
$errcode = $responseData['errcode'] ?? 205100;
$errorMsg = '';
$pos = strpos($responseData['errmsg'], ' hint:');
if ($pos === false) {
$pos = strpos($responseData['errmsg'], ' rid:');
}
if ($pos !== false) {
$errorMsg = Yii::t('wx', substr($responseData['errmsg'], 0, $pos)) . substr($responseData['errmsg'], $pos);
}
throw new ServerErrorHttpException(Yii::t('error', Yii::t('error', Yii::t('error', '205100'), ['error_code' => $errcode, 'error_msg' => $errorMsg])), 205100);
}
7. Testing the translation result, “has no masssend quota rid: 610a50c5-26966176-7cceb46e” has been translated to: 没有群发配额(订阅号为每天 1 次,服务号为每月 4 次)。rid: 610a50c5-26966176-7cceb46e. This meets expectations. See Figure 4.

8. Testing the translation result, “invalid content hint: [dN7TKA0474d139] rid: 610a5a7a-5907e6c6-270b8278” has been translated to: 无效内容(内容中包含音频)。 hint: [dN7TKA0474d139] rid: 610a5a7a-5907e6c6-270b8278. This meets expectations. See Figure 5.
![Testing the translation result, "invalid content hint: [dN7TKA0474d139] rid: 610a5a7a-5907e6c6-270b8278" has been translated to: 无效内容(内容中包含音频)。 hint: [dN7TKA0474d139] rid: 610a5a7a-5907e6c6-270b8278。Meets expectations](https://media.shuijingwanwq.com/2021/08/5-2.png)
9. Since “invalid image size” has not yet been added to the language pack, “invalid image size hint: [cl_6Oa0457mp13] rid: 6103c6d0-481a4bed-73e7120a” remains unchanged. This meets expectations.
'没有群发配额(订阅号为每天 1 次,服务号为每月 4 次)。',
'invalid content' => '无效内容(内容中包含音频)。',
'invalid image size' => '图片尺寸太大(大小必须在10MB以下)。',
];
11. Testing the translation result, “invalid image size hint: [flp8Ba0298w689] rid: 610a6969-72bb79c0-4b069755” has been translated to: invalid image size hint: [flp8Ba0298w689] rid: 610a6969-72bb79c0-4b069755. The blue box shows the English message before translation, and the red box shows the Chinese message after translation. This meets expectations. See Figure 6.
![Testing the translation result, "invalid image size hint: [flp8Ba0298w689] rid: 610a6969-72bb79c0-4b069755" has been translated to: invalid image size hint: [flp8Ba0298w689] rid: 610a6969-72bb79c0-4b069755. The blue box shows the English message before translation, and the red box shows the Chinese message after translation. Meets expectations](https://media.shuijingwanwq.com/2021/08/6-1.png)
