Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] am: invoke perl's strftime in C locale

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:55:46

"Dmitry V. Levin" [off-list ref] writes:
On Tue, Jan 15, 2013 at 08:50:59AM -0800, Jeff King wrote:
quoted
On Tue, Jan 15, 2013 at 05:42:12PM +0100, Antoine Pelisse wrote:
quoted
quoted
This puts all of perl into the C locale, which would mean error messages
from perl would be in English rather than the user's language. It
probably isn't a big deal, because that snippet of perl is short and not
likely to produce problems, but I wonder how hard it would be to set the
locale just for the strftime call.
Maybe just setting LC_TIME to C would do ...
Yeah, that is a nice simple solution. Dmitry, does just setting LC_TIME
fix the problem for you?
Just setting LC_TIME environment variable instead of LC_ALL would end up
with unreliable solution because LC_ALL has the highest priority.

If keeping error messages from perl has the utmost importance, it could be
achieved by
-			perl -M'POSIX qw(strftime)' -ne 'BEGIN { $subject = 0 }
+			perl -M'POSIX qw(strftime :locale_h)' -ne '
+				BEGIN { setlocale(LC_TIME, "C"); $subject = 0 }
but the little perl helper script we are talking about hardly worths so
much efforts.
Yeah I agree that this is not worth it, I would think.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help