In the Mail settings one can choose one of the default sounds located at /System/Library/Sounds
. Playing them is easy, e.g. with NSSound(named: "Purr")?.play()
, but how can I show a localized name for those sounds as Mail does? I couldn't find any way of getting a localized name. Would I have to manually translate each one to each supported language?
These translations are stored in these Plist files as of macOS Ventura:
/System/Applications/Mail.app/Contents/Resources/Localizable.loctable
and
/System/Library/ExtensionKit/Extensions/Sound.appex/Contents/Resources/AlertSounds.loctable
These are dictionaries. You can inspect their contents by adding .plist
extension to the file name.
I’d either copy the values from these dictionaries or try loading them programmatically at runtime. Note that the paths and contents can change between macOS releases.