An object displaying localized text in search results related to your app.


class CSLocalizedString : NSString


The CSLocalizedString class helps you localize text in searchable items. You can use a CSLocalizedString object in place of an NSString object to display localized text in search results related to your app.

For example, you might use the following code to define a CSLocalizedString object for a searchable item you want to identify as “Song” in English:

CSSearchableItem *item = [CSSearchableItem new];
    item.uniqueIdentifier = @"song";
    CSSearchableItemAttributeSet *attributes = [[CSSearchableItemAttributeSet alloc] initWithItemContentType:(NSString *)kUTTypeItem];
    item.attributeSet = attributes;
    CSLocalizedString *displayName = [[CSLocalizedString alloc] initWithLocalizedStrings:@{@"en":@"Song", @"fr":@"Chanson"}];
    attributes.displayName = displayName.localizedString;


Specifying Localized Strings

init(localizedStrings: [AnyHashable : Any])

Initializes a CSLocalizedString object with the specified dictionary of localized strings.

Getting a Localized String

func localizedString() -> String

Returns the localized string for the current language.

See Also


class CSSearchQuery

The criteria to apply when searching previously indexed app content.

class CSPerson

An object representing a person in the context of search results.