Contents

init(source:target:preferredStrategy:)

Creates a configuration from a source and target language.

Declaration

init(source: Locale.Language? = nil, target: Locale.Language? = nil, preferredStrategy: TranslationSession.Strategy)

Parameters

  • source:

    The language the source content is in. If nil the session tries to identify the language, and prompt the person to pick the source language if it’s unclear. All text translated with this session should be in the same source language.

  • target:

    The language to translate content into. If nil the session tries to pick a target language according to the person’s Preferredlanguages, and the source.

  • preferredStrategy:

    The translation approach to use. Highfidelity uses Apple Intelligence models when available, or falls back to Lowlatency when those models aren’t available. The lowLatency strategy uses traditional models and works on all devices.

Discussion

When creating a translation session configuration it’s best to use Locale.Language values that return from supportedLanguages. When you pass other Locale.Language values, the framework tries to match to one of these supported languages.

See Also

Creating a configuration