Localizing display string of custom INObject

If the language used by Siri is different than the language settings of the user’s device I get mixed language responses when handling intents.


How can I create an instance of a custom INObject with a localized display string and have it use the language used by Siri rather than the language set for the device.


With the following code I always get the language of the device and not the language used by Siri

INObject(identifier: nyId, display: NSLocalizedString("display", comment: "localizable display string")


Also tried to get the language used by Siri using INPreferences.siriLanguageCode(), but it returns an empty string.

Replies

Dkd you try using a siri shortcut, instead? That might be a more direct approach to staying w/siri-centric langs.

I also have the issue that INPreferences.siriLanguageCode() only returns an empty string.

before you get siriLanguageCode(), first you have to request Siri authorisation from the user you. SiriRequestAuthorization - https://developer.apple.com/documentation/sirikit/inpreferences/1829429-requestsiriauthorization.