[haiku-commits] Re: haiku: hrev43984 - src/apps/deskbar

  • From: "Adrien Destugues" <pulkomandy@xxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 14 Apr 2012 21:45:37 +0200

Le Sat, 14 Apr 2012 21:25:44 +0200, John Scipione <jscipione@xxxxxxxxx> a écrit:


This new format setting pulls from the Locale Kit. To tell you the truth, I'd like to add more clock formatting options, for example I'd like to add a localized short day of the week (e.g. Wed for Wednesday). I'll admit that the radio buttons will become cumbersome at that point, but, I couldn't figure out how to get the locale kit to give me a custom time format. As far as I can tell it isn't possible. For now I am using what the locale kit exposes, which is exactly 3 options, short, medium, and long. Well, technically there is a full option but that isn't useful here.

So, while I agree with you that the time format UI could use some tweaking, first the Locale Kit needs to be updated to expose more time formatting options from ICU. A method that takes a format string in and pops a time format out would be great.

http://cgit.haiku-os.org/haiku/tree/headers/os/locale/Locale.h
has GetTimeFields and FormatTime taking these fields as a parameter. That should work.

Just get the current locale from LocaleRoster, get the format, alter it the way you want, and use that when formatting.

The locale preferences used to allow setting custom formats using this, but the UI was too complex for no real use (who ever changes this ?). Still ,the sourcecode history might be worth a look.

--
Adrien.

Other related posts: