My partner needed an Alfred script to switch their Mac Catalina input source to Japanese using a keyboard shortcut because of the Moonlander.
After looking at a few (outdated) solutions on their forums and on the Internet, there didn't seem to be any reliable ones, so I just cobbled a script together.
*I'm not a Objective C developer so if you have any improvements, feel free to update this.
General idea is to get a list of your available input sources, iterate until we find one that has a localized name that matches the parameter you pass in,