Unable to localize Siri intent response
In my project, I want my custom intent response be localized to user's Siri language. The custom intent response has a String
type property, and in the intent handler, a NSLocalizedString
is passed to that property:
NSString *text = NSLocalizedString(@"response", nil);
__auto_type response = [IntentIntentResponse successIntentResponseWithText:text];
completion(response);
When Siri language is set to English, the intent reponse is corretly localized on screen and read out by Siri:
However, when Siri language is set to Chinese or Japanese, the localized part is missing from Siri response, leaving only "OK, done.":
And if this intent is invoked from the Shortcuts app, the localized part is corretly displayed in the pop over window, so I guess the localized string is successfully passed to the system.
So the question is, how do I make the response string localized in Siri when Siri language is set to a language other than English?
Xcode 12.3 iPhone SE2 (iOS 14.3)
- Download the demo project from https://github.com/eternityz/SiriLocalizationIssue
- Open the demo project in Xcode
- Build and run on an iOS 14 device.
- Launch the app, add the intent to Siri with a custom phrase.
- Make sure your Siri language is English. Invoke Siri with the custom phrase just set.
- Set Siri language to Chinese.
- Invoke Siri with the same custom phrase.