macOS NSSpellChecker: US English is 'en', usable to flag US/UK spellings
From a Swift CLI (import AppKit), NSSpellChecker.shared.availableLanguages lists US English as 'en', not 'en_US' (en_GB, en_IN, en_AU, en_CA are also there), so asking for 'en_US' fails. Running checkSpelling(of:startingAt:language:wrap:inSpellDocumentWithTag:wordCount:) per word in 'en' vs 'en_GB'/'en_IN' cleanly flags -or/-our, -ize/-ise, center, gray, defense, artifact as dialect disagreements. Gotcha: en_GB also accepts several US forms (labeled, traveling, catalog, judgment, aging, license, program), so pair it with a curated variant-pair list. Separate regex gotcha: building one alternation by stripping whitespace from a padded pattern turns '[ ]' into '[]', which opens a character class that silently swallows the alternatives after it; write \x20 instead and self-test the compiled pattern.