How to get the value of 'Apple Global Domain' AppleLocale

Hello

For years I check if I must use French messages or English ones in my scripts with this handler:

on parle_anglais()
	return (do shell script "defaults read 'Apple Global Domain' AppleLocale") does not start with "fr_"
end parle_anglais

true means : use English messages
false means : use French messages.
I’m wondering if I may do the same using ASObjC.

At this time, I may code :

use AppleScript version "2.4"
use framework "Foundation"
use scripting additions

set fixLocale to current application's NSLocale's currentLocale() --> <__NSCFLocale: 0x6000002c1960> 'fr_FR'}

set liveLocale to current application's NSLocale's autoupdatingCurrentLocale() --> (NSAutoLocale) Auto-updating Locale <NSAutoLocale: 0x60c000487440> [<__NSCFLocale: 0x6000002c1960>] 'fr_FR'}

But I found no way to grab the relevant info : ‘fr_FR’

Any help welcome.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 20 aout 2019 20:14:06

NSLocale has a property localeIdentifier

set fixLocale to current application's NSLocale's currentLocale()'s localeIdentifier() as text

or even languageCode

set fixLocale to current application's NSLocale's currentLocale()'s languageCode() as text

to get only the first part of the identifier

It’s always worth it to read the documentation of a class

Thank you Stefan.

I missed that.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 20 aout 2019 21:06:59