git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cogito: use locale date_fmt in obtaining default date format
@ 2005-10-12 14:02 Junichi Uekawa
  2005-10-12 15:26 ` Junichi Uekawa
  0 siblings, 1 reply; 2+ messages in thread
From: Junichi Uekawa @ 2005-10-12 14:02 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 350 bytes --]

Obtain the default date format information from the locale database 
if it's available. Currently, the default date is in a fixed format that 
is mostly US-centric; which results in a very weird-looking Japanese
date.


Signed-off-by: Junichi Uekawa <dancer@debian.org>

---


 cg-Xlib |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)



[-- Attachment #2: date_in_locale.diff --]
[-- Type: application/octet-stream, Size: 515 bytes --]

diff --git a/cg-Xlib b/cg-Xlib
index 0ed275f..d6d0cc1 100755
--- a/cg-Xlib
+++ b/cg-Xlib
@@ -210,7 +210,9 @@ showdate()
 	# bash doesn't like leading zeros
 	[ "${tzhours:1:1}" = 0 ] && tzhours=${2:0:1}${2:2:1}
 	secs=$(($secs + $tzhours * 3600 + $tzmins * 60))
-	[ "$format" ] || format="+%a, %d %b %Y %H:%M:%S $2"
+	[ "$format" ] || \
+		format="+$(locale date_fmt)" || \
+		format="+%a, %d %b %Y %H:%M:%S $2"
 	if [ "$has_gnudate" ]; then
 		LANG=C $has_gnudate -ud "1970-01-01 UTC + $secs sec" "$format"
 	else

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cogito: use locale date_fmt in obtaining default date format
  2005-10-12 14:02 [PATCH] cogito: use locale date_fmt in obtaining default date format Junichi Uekawa
@ 2005-10-12 15:26 ` Junichi Uekawa
  0 siblings, 0 replies; 2+ messages in thread
From: Junichi Uekawa @ 2005-10-12 15:26 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

Hi,

>  	if [ "$has_gnudate" ]; then
>  		LANG=C $has_gnudate -ud "1970-01-01 UTC + $secs sec" "$format"
>  	else

Hmm... I just noticed that you're setting LANG=C here;
which is not enough since LC_ALL will override the value.

I'm not quite sure of the original intention;
I've checked the users


cg-log:
	For local display; it should be okay to show the date in 
	localized format.

cg-mkpatch:
	It might be intrusive to have a localized date in a patch;
	so having a localized output of showdate is mostly undesirable,
	but it will depend on the project you work on.
	(The user can always unset locale)


regards,
	junichi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-10-12 15:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-12 14:02 [PATCH] cogito: use locale date_fmt in obtaining default date format Junichi Uekawa
2005-10-12 15:26 ` Junichi Uekawa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).