Class

CSLocalizedString

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

Declaration

@interface CSLocalizedString : NSString

Overview

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;

Topics

Specifying Localized Strings

- initWithLocalizedStrings:

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

Getting a Localized String

- localizedString

Returns the localized string for the current language.

Relationships

Inherits From

See Also

Queries

CSSearchQuery

The criteria to apply when searching previously indexed app content.

CSPerson

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