<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MediaAccessibility",
  "identifier" : "/documentation/MediaAccessibility/MACaptionAppearanceAddSelectedLanguage(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Media Accessibility"
    ],
    "preciseIdentifier" : "c:@F@MACaptionAppearanceAddSelectedLanguage"
  },
  "title" : "MACaptionAppearanceAddSelectedLanguage(_:_:)"
}
-->

# MACaptionAppearanceAddSelectedLanguage(_:_:)

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

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

## Parameters

`domain`

The domain to retrieve the preference value from. See [`MACaptionAppearanceDomain`](/documentation/MediaAccessibility/MACaptionAppearanceDomain). Pass [`MACaptionAppearanceDomain.user`](/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

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(_:)`](/documentation/MediaAccessibility/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:

```objc
 // 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]);
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)