Alex,

This is interesting, and thanks for digging it up.

Using this plist it appears that I could use [[NSUserDefaults 
standardUserDefaults]  addSuiteNamed:@"com.apple.menuextra.clock"] and access 
this data with the key 'DateFormat'.  I'm not sure I want to do this.  I expect 
there is a degree of fragility.  Apple could change the domain or the key.  
But, it's good to be able to consider it.  With this I could find out how the 
user has there clock configured.

Although, here I'm not sure I should look for 'a'.  Previously I was relying on 
the template functionality's response to the special token of 'j'. As your 
examples illustrate, the absence of 'a' could just indicate the preference of 
no 'period' in the format string.  But the uppercase 'H' is a strong enough 
indicator.

Thanks again for your time and thoughts.

Sandor

> On Jan 4, 2017, at 00:54, Alex Zavatone <z...@mac.com> wrote:
> 
> OK.  All that NSLocale stuff seemed like "The right way to do it™" but…
> 
> Let's see if this gets you what you want.
> 
> Read this file:
> 
> ~/Library/Preferences/
> com.apple.menuextra.clock.plist
> 
> And you'll see…
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
> "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
> <plist version="1.0">
> <string>EEE h:mm </string>
> </plist>
> 
> 
> Or
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
> "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
> <plist version="1.0">
> <string>EEE h:mm a</string>
> </plist>
> 
> Or
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
> "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
> <plist version="1.0">
> <string>EEE H:mm</string>
> </plist>
> 
> The differences here are:
> 
> EEE h:mm – 12 hour clock, no AM/PM shown
> EEE h:mm a – 12 hour clock, AM/PM shown
> EEE H:mm – 24 hour clock
> 
> Hope that helps.
> 
> - Z
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to