-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added translator for constants. #1137
Conversation
就是那个翻译的组件,key 中间加空格也ok得
发自我的iPhone
…------------------ Original ------------------
From: 黄朝晖 <notifications@github.com>
Date: Sun,Dec 15,2019 11:10 AM
To: hyperf/hyperf <hyperf@noreply.github.com>
Cc: 李铭昕 <l@hyperf.io>, Author <author@noreply.github.com>
Subject: Re: [hyperf/hyperf] Added translator for constants. (#1137)
@huangzhhui commented on this pull request.
In src/constants/tests/Stub/ErrorCodeStub.php:
@@ -33,4 +33,14 @@ class ErrorCodeStub extends AbstractConstants * @message("Params[%s] is invalid.") */ const PARAMS_INVALID = 503; + + /** + * @message("error.message") + */ + const TRANSLATOR_ERROR_MESSAGE = 504; + + /** + * @message("error.not exist")
这里的空格怎么理解?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
|
||
// 1.2 版本以下 可以使用以下方式,但会在 1.2 版本移除 | ||
|
||
$message = ErrorCode::getMessage(ErrorCode::PARAMS_INVALID, 'user_id'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里意思是以后不再使用字符串格式化的方式来作为占位符了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以这么写
$message = ErrorCode::getMessage(ErrorCode::PARAMS_INVALID, ['user_id']);
fix #1112