Can't get Text Input Source region designator

I have a macOS application with a minimum version of macOS 12.0. I need to be able to get the current keyboard region designator. Example: The user selects a input source of English Canadian. What I want as a result of this fact is en-CA locale identifier. I get the current keyboard language with the following code

func keyboardLanguage() -> String?{
 let keyboard = TISCopyCurrentKeyboardInputSource().takeRetainedValue()
let languagesPtr = TISGetInputSourceProperty(keyboard, kTISPropertyInputSourceLanguages)!
let languages = Unmanaged<AnyObject>.fromOpaque(languagesPtr).takeUnretainedValue() as? [String]
return languages?.first
}

This returns the language as en, but I don't see how I can get the region from Text Input Sources. I can get the input source id

let keyboard = TISCopyCurrentKeyboardInputSource().takeRetainedValue()
let idPtr = TISGetInputSourceProperty(keyboard, kTISPropertyInputSourceID)!
let id = Unmanaged<AnyObject>.fromOpaque(idPtr).takeUnretainedValue() as? String
print(String(describing: id))

This prints com.apple.keylayout.Canadian which points to the Canadian region but is not a region designator. I can possible parse this id and map it to a region designator but first I'm not sure if I will capture all of the regions and secondly what happens if the format of the id changes? If someone can point to the correct API to use it will be much appreciated.

Can't get Text Input Source region designator
 
 
Q