Adds a preference for caption language to stack of languages.


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



The domain to retrieve the preference value from. See MACaptionAppearanceDomain. Pass MACaptionAppearanceDomain.user unless the system defaults are needed for comparison.


A canonical language identifier (see 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.


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

Accessing Language Preferences