Localised weekday?

Or much more simply:

set theDays to (current application's NSDateFormatter's new()'s weekdaySymbols()) as list

I notice that nobody mentioned:

user locale of (system info)

I think nobody thought about that, I have to admit that I didn’t. As an excuse, I have searched for ‘locale’ in the standard addition osax and no result.

I looked too! In System Events! But at that moment, I thought that the LC_ALL setting of the shell was how Mac OsX was configured as standard, so I didn’t look that closely! :slight_smile:

Edit

But honestly, that command uses a looong time to complete, at least by me! :slight_smile:

Edit

I’d rather use this:

set ulc to (do shell script "defaults read -g AppleLocale")

Though it doesn’t return the 100% correct form, which System Info does, the thing is, is that it is two dialects of my language, so System Info returns nb_NO, (the other would have been ny_NO), but AppleLocale has specified no_NO as a catchall.

You mustn’t have searched properly:

do shell script "grep -i locale /System/Library/ScriptingAdditions/StandardAdditions.osax/Contents/Resources/StandardAdditions.sdef"

:wink:

It raises an interesting point, too. The shell-based solutions all rely on the contents of /usr/share/locale/, which on my Mac has 230 folders. This means considerably fewer than 100 locales. But theses are presumably unix locales, and not the actual locales used at higher levels of the OS, which are presumably part of the ICU library.

If I call NSLocale’s availableLocaleIdentifiers method, which, according to the docs, returns “An array of NSString objects, each of which identifies a locale available on the system”, I get 494 locales. I’m guessing that user locale uses the same list of locales, and could therefore return a locale for which no LC_TIME file exists.

McUsr wrote:

That was very badly put of me, by vanilla AS, I don’t include do shell script stuff, what I should have written was, is there a way in vanilla as to do what the code below does.

And I have found it with System Info, but that is just unusable, as it seems that System Info is doing a full System Inspection, before it cares to reply to the request :slight_smile:

The closest I have got to vanilla is

set ulc to (do shell script "defaults read -g AppleLocale")

I am actually looking for a more precise variable as we speak, and I heading into gestalts.:frowning:

Edit The code above works perfectly fine now, and how did that happen?

I think I may have looked at the wrong results pane in Script Debugger the first time :frowning: