Hello,
My app depends on the Translation framework (iOS 17.4+), but I've found out that it doesn't work unless the Apple Translate app is installed on the device. After I've deleted Apple's translation app, I started getting the following errors:
Optional(Foundation.Locale.Language(components: Foundation.Locale.Language.Components(languageCode: Optional(en), script: nil, region: Optional(GB)))) Optional(Foundation.Locale.Language(components: Foundation.Locale.Language.Components(languageCode: Optional(es), script: nil, region: Optional(ES))))
Error sending 1 paragraphs Error Domain=TranslationErrorDomain Code=16 "Translation failed" UserInfo={NSLocalizedDescription=Translation failed, NSLocalizedFailureReason=Offline models not available for language pair}
Failed to translate input 0; returning error: Error Domain=TranslationErrorDomain Code=16 "Translation failed" UserInfo={NSLocalizedDescription=Translation failed, NSLocalizedFailureReason=Offline models not available for language pair}
Received unbridged NSError to API, converting to `.internalError`: Error Domain=TranslationErrorDomain Code=16 "Translation failed" UserInfo={NSLocalizedDescription=Translation failed, NSLocalizedFailureReason=Offline models not available for language pair}
TranslationError(cause: Translation.TranslationError.Cause.internalError, sourceLanguage: nil, targetLanguage: nil)
This is an example from trying to translate text from English to Spanish. And I was receiving the error even though I have the dictionaries downloaded.
Once I reinstalled Apple's Translate app, it started working again.
This sadly means that users of my app must have the factory translation app installed, otherwise they won't be able to use my app. Some people choose to delete the factory apps. Why is the framework not available then? :(