Contents

skipsTranslation

An attribute that marks portions of an attributed string to be excluded from translation.

Declaration

let skipsTranslation: AttributeScopes.TranslationAttributes.SkipTranslationAttribute

Discussion

Use this to exclude specific text ranges within an AttributedString from translation, such as proper nouns, brand names, technical terms, or other content that should remain unchanged across different languages.

When translating formatted text, you can mark specific ranges to skip translation:

var text = AttributedString("Welcome to Apple Park")
let range = text.range(of: "Apple Park")!
text[range].skipsTranslation = true

When translated the string, “Welcome to” changes to the target language, but “Apple Park” remains unchanged.

See Also

Handling translation behavior