Sandor, just to let you know, all I did was go into the Date & Time System
Preference, and do the following:
Set the Time options to
- Use a 24 hour clock
- Open ~/Library/Preferences/com.apple.menuextra.clock.plist
- Copy and paste the contents into the email.
Set the Time options to
- Uncheck Use a 24 hour clock
- Check Show AM/PM
- Open ~/Library/Preferences/com.apple.menuextra.clock.plist
- Copy and paste the contents into the email.
Set the Time options to
- Uncheck Use a 24 hour clock
- Uncheck Show AM/PM
- Open ~/Library/Preferences/com.apple.menuextra.clock.plist
- Copy and paste the contents into the email.
So, all I did was give you the results that are stored within that file after I
made those changes. It’s up to you to do whatever you want with the data I
sent you. Those are the values that Apple stores. It’s up to you to do
anything with that data if you want to. I just wanted to point out to you that
it exists.
Now, I did look at the NSLocale to see it I could get something for you but
work called. If you still are looking for a solution in a while, I will be
happy to see if I learn something making a category off of NSLocale to spit out
its guts.
Happy to be of help, Sandor. Let us know how it goes.
Cheers,
Alex Zavatone
> On Jan 4, 2017, at 2:14 PM, Sandor Szatmari <[email protected]>
> wrote:
>
> 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 <[email protected] <mailto:[email protected]>>
> 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
>> <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
>> <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
>> <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
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list ([email protected]) 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 [email protected]
