Thanks for sharing your thoughts on my idea. Fortunately, this is a low-level, far-milestone task, so I still have some time to consider resolution here.
I think there will be no class changes to Yii 2 anymore, except the ones to fix serious security issues (and I don’t think that there can be any serious security issue around table that returns some texts; this is the only thing that I am going to override, if I’ll go with this idea).
I think that the whole core team is 100% occupied with developing Yii 3 (minus those possible security issues found in Yii 2). And that Yii 2 is already or soon will be in security-maintainance mode, slowly being phased out.
As I said, solving this issue isn’t a problem. It much more bothers me, why it was done like that? I am waiting, if @samdark or someone else out of core team has a spare minute to shed a light on this? Was it simply omitted due to being forgotten? Or was it left as it is intentionally (i.e. 100% compatibility with core HTTP Statuses RFC)?
I haven’t traced the Response lifecycle but I’m betting on it is for performance reasons. If the array (67 elements) would be resolved with translations on every request, the process would be unnecessarily heavy.
I made only basic tracing and, if I am correct, though yii\base\Request component is indeed used in every life-cycle or every request, the array itself is used only in erroneous conditions. Like using yii\web\ErrorAction or yii\web\NotFoundHttpException. I.e. in scenarios where you doesn’t get much attention to performance, because your application is already dying.
When I decide to follow this path, I’ll have to of course do much more tests on this. Thanks for pointing this out.
Note that these statuses are used in response header, so I would not advise to change them. If you want translated error messages, I suggest to process these exceptions in error action instead of changing anything in Request class.
Dump question: if I understand you correctly all that matters for you is your page title?
So why don’t you just translate that one instead of overwriting the class?
Somewhere in your error html you have to output the title - you could change that.