Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
better dates in Mozilla Thunderbird reply_header?
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
wylbur
n00b
n00b


Joined: 22 Mar 2003
Posts: 47
Location: 32C, an aisle seat near the back

PostPosted: Sat Feb 05, 2005 7:22 pm    Post subject: better dates in Mozilla Thunderbird reply_header? Reply with quote

Does anyone know how/if I could use strftime-like functions to customize the Mozilla Thunderbird [version 1.0 (20041231)] reply_header fields? I want my replies to look like

Code:
On Fri Feb  4 21:25:22 PST 2005, The_little_pig wrote:
> Hi wylbur,
...


There's a very small set of changes for the reply_header possible in tbird's user.js:

Code:
// Change the reply header
// 0 - No Reply-Text
// 1 - "[Author] wrote:"
// 2 - "On [date] [author] wrote:"
// 3 - User-defined reply header.
user_pref("mailnews.reply_header_type", 3);

// If you set 3 for the pref above then you may set the following
// prefs.
user_pref("mailnews.reply_header_authorwrote", "%s wrote");
user_pref("mailnews.reply_header_separator", " ");
user_pref("mailnews.reply_header_ondate", "on %s");
user_pref("mailnews.reply_header_colon", ":");

So wouldn't it be nice to be able to put an actual strftime specification in the reply_header_ondate string instead of the limp little %s?

Of course, it would also be nice to do that for the mail.ui.display.dateformat.* variables, which I can't seem to change no matter what.

O, how I loathe ambiguous mm/dd/yy dates! Are they dd/mm/yy? or yy/mm/dd? in this month and year, any combination is possible.

experiences? ideas? -- wylbur.
Back to top
View user's profile Send private message
Chaosite
Guru
Guru


Joined: 13 Dec 2003
Posts: 540
Location: Right over here.

PostPosted: Sat Feb 05, 2005 8:25 pm    Post subject: Reply with quote

No idea, other than the fact that I never seen yy/mm/dd dates... They usually come up as yyyy/mm/dd, right?
Back to top
View user's profile Send private message
zervus
Tux's lil' helper
Tux's lil' helper


Joined: 19 Jan 2005
Posts: 133

PostPosted: Sat Feb 05, 2005 8:34 pm    Post subject: Re: better dates in Mozilla Thunderbird reply_header? Reply with quote

wylbur wrote:
Of course, it would also be nice to do that for the mail.ui.display.dateformat.* variables, which I can't seem to change no matter what.

They depend on the value of your LANG environment variable. At first I got yyyy/mm/dd and after setting it to "de_DE@euro" I get dd.mm.yyyy.
Back to top
View user's profile Send private message
wylbur
n00b
n00b


Joined: 22 Mar 2003
Posts: 47
Location: 32C, an aisle seat near the back

PostPosted: Sat Feb 05, 2005 8:46 pm    Post subject: environment variables Reply with quote

in my googling, I found that the environment variable LC_TIME affects the reply_header_ondate formatting. I've just changed LC_time to "de_DE@euro" and I get the dd.mm.yyyy format in the reply -- yay! That's not what zervus reported, but it's always nice to be able to affect the thing we want to fix.

I'll play with LANG next, but I don't want to hose the dictionary settings (which I need to keep pointed at en_US).

Does anyone know of a listing of all the date locale formats? I've man'd locale and setlocale and strftime to no avail. thanks -- wylbur.
Back to top
View user's profile Send private message
wylbur
n00b
n00b


Joined: 22 Mar 2003
Posts: 47
Location: 32C, an aisle seat near the back

PostPosted: Sat Feb 05, 2005 9:16 pm    Post subject: locale src files Reply with quote

Ok, I've made progress. This is clearly something I'm spending WAY too much time on, but...

with LC_TIME=en_US, here are the settings:

Code:

$ locale -c LC_TIME
LC_TIME
Sun;Mon;Tue;Wed;Thu;Fri;Sat
Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday
Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec
January;February;March;April;May;June;July;August;September;October;November;December
AM;PM
%a %d %b %Y %r %Z
%m/%d/%Y
%r
%I:%M:%S %p






0
S
7
19971201
4
1
1
1

%a %b %e %H:%M:%S %Z %Y
ISO-8859-1


AFAICT, this means that the basic date result is %m/%d/%Y, and the time result is %r, both of which make sense in strftime-speak. So, if I could hack a new locale, I could force a nice date into Thunderbird.

*HOWEVER*, doing so would merrily hose every other date output (e.g., ls -l) on my system. Just setting LC_TIME="de_DE" adds a period in ls dates:

Code:
wylbur@snowball:/usr/lib/locale/en_US
$ ls -l
total 236
-rw-r--r--   1 root root    160  8. Nov 04:07 LC_ADDRESS
-rw-r--r--  44 root root  21499  8. Nov 04:07 LC_COLLATE
<snip>


fsck! Any thoughts? -- wylbur.
Back to top
View user's profile Send private message
zervus
Tux's lil' helper
Tux's lil' helper


Joined: 19 Jan 2005
Posts: 133

PostPosted: Sat Feb 05, 2005 9:31 pm    Post subject: Reply with quote

Yep, there's more than one environment variable that affects your language and time settings. I didn't know about LC_TIME, but thanks for reporting, I think that fits me better than using LANG as well.

I guess you could just use
Code:
LC_TIME="de_DE" thunderbird

to fire up your Thunderbird without affecting ls and other programs...
Back to top
View user's profile Send private message
wylbur
n00b
n00b


Joined: 22 Mar 2003
Posts: 47
Location: 32C, an aisle seat near the back

PostPosted: Sat Feb 05, 2005 10:27 pm    Post subject: more on this Reply with quote

resetting LC_TIME just before thunderbird is a great idea, zervus. Here's a bit more info.

The tbird folks define 5 "modes" for date displays (http://kb-upgrade.mozillazine.org/Change_the_Date_Format). Modes 0, 3, and 4 seem hard-coded to fairly obvious strftime values.

Modes 1 and 2, however, depend on the strftime definitions in the LC_TIME section of the current locale. The reply_header_ontime seems to be hard-linked to mode 1, the long form.

Unfortunately, for en_* locales (AU US GB BW IE NZ ZA ZW DK) , mode 1==mode 2 in tbird. In locales (HK IN PH SG), mode 1 is truly long in tbird date displays. Locale DK has an especially nice mode 2, IMO.

In my crude hacking, it seems that mode 1 is what the locale definition (found in /usr/share/i18n/locales) calls d_t_fmt, and mode 2 is d_fmt. The frustrating part is that in the en_US locale file, d_t_fmt != d_fmt, but nonetheless in tbird, mode 1 == mode 2.

The giveaway, though, is that the en_SG d_t_fmt is a little buggy (too many commas, not enough spaces), and that bug shows up in the locale file and in tbird mode 1 displays.

I'm done, I've got real work to do. LC_TIME="en_IN" for me (even though I prefer en_DK for mode 2). If anyone decides to hack the locale files, I'd be a happy guinea pig.

-- wylbur
Back to top
View user's profile Send private message
bludger
Guru
Guru


Joined: 09 Apr 2003
Posts: 389

PostPosted: Mon Mar 07, 2005 12:51 pm    Post subject: Reply with quote

I am an Australian living in Germany. I am used to the German way of writing the date and time by now (dd.mm.yyyy + 24 hour time) but still prefer to see my text in English when given the choice. I prefer this, not only because I am used to it now, but after many years as an international citizen, I find dd/mm/yyy and mm/dd/yyy confusing.

If I set LC_TIME to de_DE@euro, then I get the numberic formats that I want, but the text of the days and dates are written in German. I can read the German text, but call me fussy, I would just prefer to have it in English if possible.

Is there a pre-existing locale for this, or would I have to create my own? Does anyone know how to go about this?
Back to top
View user's profile Send private message
bludger
Guru
Guru


Joined: 09 Apr 2003
Posts: 389

PostPosted: Mon Mar 07, 2005 2:23 pm    Post subject: Reply with quote

I just had a go creating my own locale.

I compared en_AU, en_IE and de_DE and basically ended up taking en_AU as a base and changing the euro field and the date format fields. I also used http://www.open-std.org/jtc1/sc22/wg20/docs/n897-14652w25.pdf as a reference.

cd /usr/share/i18n/locales
diff en_AU en_bludger
59c59
< currency_symbol "<U0024>"
---
> currency_symbol "<U20AC>"
112c112
< d_fmt "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0079>"
---
> d_fmt "<U0025><U0064><U002E><U0025><U006D><U002E><U0025><U0079>"
114,116c114,115
< am_pm "<U0041><U004D>";"<U0050><U004D>"
< t_fmt_ampm "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
< <U0025><U0070>"
---
> am_pm "";""
> t_fmt_ampm ""

localedef -i en_bludger -f ISO-8859-15 en_bludger (to write create the locale)
then edit /etc/env.d/02locale and env-update

I might have to edit this again to further customise it, I suppose.
Back to top
View user's profile Send private message
bludger
Guru
Guru


Joined: 09 Apr 2003
Posts: 389

PostPosted: Tue Mar 08, 2005 10:01 am    Post subject: Reply with quote

I was not sure whether I had to rebuild glibc after creating this new locale, but I don't think so. After I did rebuild it, "locale -a" did not show my new locale, so I loaded it again with localedef and there it was.

The problem is that Xlibs don't recognise the new locale. If I try to load any X application, I get the message "locale not supported by Xlib, locale set to C". I tried mucking around with /usr/X11R6/lib/X11/locale/locale.alias, but to no avail.

Does anyone have any idea how to get this working? Otherwise I will just have to switch back to a mix of en_IE and de_DE.
Back to top
View user's profile Send private message
bludger
Guru
Guru


Joined: 09 Apr 2003
Posts: 389

PostPosted: Thu Jun 09, 2005 6:27 am    Post subject: Reply with quote

I also prefer 09.06.2005 to 09.06.05, so I edited
/usr/share/i18n/locales again and changed
d_fmt "<U0025><U0064><U002E><U0025><U006D><U002E><U0025><U0079>"
to
d_fmt "<U0025><U0064><U002E><U0025><U006D><U002E><U0025><U0059>"
(ie. %y to %Y)

I also noticed that you have to specify the destination path with localeconf:
localedef -i en_bludger -f ISO-8859-15 /usr/lib/locale/en_bludger

Editing /usr/lib/X11/locale/locale.alias with
en_bludger: en_IE.ISO8859-15
seemed to fix the error message. Strangely, I still get the date format in thunderbird that I want though. ie. 09.06.2005 with en_bludger instead of 09/06/05 with en_IE. If someone can explain this, I would appreciate it.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum