---
title: "MACaptionAppearanceAddSelectedLanguage(_:_:)"
framework: mediaaccessibility
role: symbol
role_heading: Function
path: "mediaaccessibility/macaptionappearanceaddselectedlanguage(_:_:)"
---

# MACaptionAppearanceAddSelectedLanguage(_:_:)

Adds a preference for caption language to the stack of languages.

## Declaration

```swift
func MACaptionAppearanceAddSelectedLanguage(_ domain: MACaptionAppearanceDomain, _ language: CFString) -> Bool
```

## Parameters

- `domain`: The domain to retrieve the preference value from. See doc://com.apple.mediaaccessibility/documentation/MediaAccessibility/MACaptionAppearanceDomain. Pass doc://com.apple.mediaaccessibility/documentation/MediaAccessibility/MACaptionAppearanceDomain/user unless the system defaults are needed for comparison.
- `language`: A canonical language identifier (see doc://com.apple.documentation/documentation/CoreFoundation/CFLocale) of the preferred caption language.

## Return Value

Return Value Returns true if addition was successful; false if an error occurred. Errors are most likely the result of invalid language codes. Discussion The added language will appear in the array returned by MACaptionAppearanceCopySelectedLanguages(_:). Call the MACaptionAppearanceAddSelectedLanguage function anytime a user selects a specific captioning language from a pop-up menu or other UI affordance. For example, an AVFoundation client may execute the following code:  // in response to a user selection, make the selection effective -[AVPlayerItem selectMediaOption:legibleOption inMediaSelectionGroup:legibleGroup];   // now update system-wide captioning preferences by registering the added language MACaptionAppearanceAddSelectedLanguage(kMACaptionAppearanceDomainUser, (CFStringRef)[[legibleOption locale] localeIdentifier]);

## See Also

### Language settings

- [MACaptionAppearanceCopySelectedLanguages(_:)](mediaaccessibility/macaptionappearancecopyselectedlanguages(_:).md)
