Make the new Translation API available beyond SwiftUI

The Translation API introduced at Session 10117 is impressive, but limiting it to SwiftUI is restrictive.

This API works great in the demo, but for more complex apps, it lacks flexibility because it is bound to SwiftUI Views.

Please consider making it available in non-SwiftUI environments.

Thank you for your interest in this new feature.

Although, it is best to share your thoughts about new features and feature requests via http://feedbackassistant.apple.com/ where the relevant teams would be able to evaluate such requests.

same thought, Im wondering if there's walk around at the current state.

It would be great if there was support for UIKit. SwiftUI still lacks a lot of the customisation points necessary to get a native app feel in advanced use cases involving text.

Agreed - it's disheartening to see UIKit left out in the cold like this! It's going to be years before our large codebase is shifted completely over.

FB13881349

Thank you for checking out the Translation API and letting us know what you think.

While the Translation APIs do need to be triggered from SwiftUI, there's still a straightforward workaround to get this working from a mostly UIKit (or AppKit) app. You can add UIHostingController (or NSHostingController) to the place in your app you want any translation UI to present from. You can add the .translationPresentation or .translationTask modifier to a simple SwiftUI view, even though most of your app doesn't use SwiftUI.

This API is super exciting! How does this work with localization?

  • Are the strings produced by this API suitable for use with app UIs?
  • Can the output of a translationTask be safely dropped in to a String Catalog?
  • Are these APIs intended to replace/supplement existing localization technologies?

@mb-foreflight I can imagine using the Translation API as part of a location workflow. Not as a replacement for the entire process but for example to automatically generate suggestions for your localization team. It is always a good idea to verify translations are appropriate for your specific app UI.

Damn Apple; don’t provide UIKit APIs and force users to rely solely on SwiftUI

Make the new Translation API available beyond SwiftUI
 
 
Q