Defect #32518
openIncoming mails handled by MailHandler sometimes logs with the wrong locale
0%
Description
It happens from time to time that MailHandler logs errors related to incoming email messages
with the wrong locale (for instance in Japanese while my system is set to English by default).
For instance:
Nov 26 08:20:33 [ERROR] MailHandler: Validation failed: 类别 不能为空字符, 计划完成日期 不能为空字符, 预期时
Instead of:
Nov 26 16:18:02 [ERROR] MailHandler: Validation failed: Assignee cannot be blank, Category cannot be blank, Due date cannot be blank, Estimated time cannot be blank
I think this might be due to the locale leaking from previous unrelated requests, as
explained in e.g.:
https://edgeguides.rubyonrails.org/i18n.html#managing-the-locale-across-requests
Here is a tiny patch (agains 4.0.5) that explcitly sets the locale to English, since most of
the error messages printed in MailHandler are in English already. I set the locale just
before calling 'dispatch', as this is 'dispatch' that can actually make use of the locale.
But I guess it could be set anywhere that makes sense.
Files
Updated by Anthony Mallet about 5 years ago
A precision: the users that trigger this wrong locale for sure do not have their own language or anything set to Japanese.
They typically use English.