I am trying to use DateComponentsFormatter() with my AppIntent, but I can not find a way to localize the formatter string with the same language that LocalizedStringResource use...
Example (My App: Arabic, Device: English, Siri: English)
let formatter = DateComponentsFormatter()
formatter.unitsStyle = .full
formatter.maximumUnitCount = 2
formatter.allowedUnits = [.hour, .minute]
formatter.includesTimeRemainingPhrase = true
let relativeDate = formatter.string(from: .now, to: nextEvent.date) ?? ""
return .result(
value: value,
dialog: "intent_current_event\(relativeDate)"
)
The result is: Next event متبقي 4 ساعات و 5 دقائق
The relativeDate is in Arabic (App Language) and the "intent_current_event%@" localized in English (Siri Language)
Can anyone please help me to use the Formatter and get it to localized the same local as LocalizedStringResource.