Translation API not working without the Apple Translate app installed

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? :(

Answered by DTS Engineer in 847280022

Reviewing the documentation and WWDC session I don't see anything about the Translation framework requiring the Translate app being installed. Unless I missed something, this could be bug. However, the settings area for the Translate app appears to be he place where you manage and download languages to available to the Translation framework. Are you making appropriate checks to make sure the languages you are trying to use are installed and available for translation?

Please see the directions starting at ~ 12:00 in the following presentation for how to check if a language is available:

Meet the Translation API

If those checks fail, you can present directions for the user explaining how to fix the problem instead of crashing.

If that does not help, our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. Please file a bug report, include a small Xcode project and some directions that can be used to reproduce the problem, and post the Feedback number here once you do. If you post the Feedback number here I'll check the status next time I do a sweep of forums posts where I've suggested bug reports.

Bug Reporting: How and Why? has tips on creating your bug report.

Reviewing the documentation and WWDC session I don't see anything about the Translation framework requiring the Translate app being installed. Unless I missed something, this could be bug. However, the settings area for the Translate app appears to be he place where you manage and download languages to available to the Translation framework. Are you making appropriate checks to make sure the languages you are trying to use are installed and available for translation?

Please see the directions starting at ~ 12:00 in the following presentation for how to check if a language is available:

Meet the Translation API

If those checks fail, you can present directions for the user explaining how to fix the problem instead of crashing.

If that does not help, our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. Please file a bug report, include a small Xcode project and some directions that can be used to reproduce the problem, and post the Feedback number here once you do. If you post the Feedback number here I'll check the status next time I do a sweep of forums posts where I've suggested bug reports.

Bug Reporting: How and Why? has tips on creating your bug report.

Translation API not working without the Apple Translate app installed
 
 
Q