Translation
Translate text in your app from one language to another.
Overview
Offer in-app translations with the Translation framework. You can use the built-in UI and let the system offer a translation to users on your behalf. Or you can use the framework to customize the translation experience.
[Image]
To offer the built-in system translation experience, anchor the translationPresentation(isPresented:text:attachmentAnchor:arrowEdge:replacementAction:) view modifier to the SwiftUI view containing the text to translate. Set isPresented to true when you want to the built-in system translation UI to appear. Pass the text to translate to the text parameter.
To customize the translation experience use one of the translation tasks such as translationTask(_:action:). These functions provides you with a TranslationSession that you can use to translate strings of text one at a time, or in a batch. You can check language availability before offering a translation with the LanguageAvailability class.
Topics
Essentials
Translating text within your apptranslationPresentation(isPresented:text:attachmentAnchor:arrowEdge:replacementAction:)translationTask(_:action:)translationTask(source:target:action:)TranslationSession